Skip to content

Commit d1941ee

Browse files
authored
fix: y tick anchors going beyond chart (#2536)
1 parent 1e06dda commit d1941ee

File tree

1 file changed

+15
-15
lines changed

1 file changed

+15
-15
lines changed

packages/chart/src/components/LinearChart.tsx

Lines changed: 15 additions & 15 deletions
Original file line numberDiff line numberDiff line change
@@ -964,13 +964,13 @@ const LinearChart = forwardRef<SVGAElement, LinearChartProps>(({ parentHeight, p
964964
return (
965965
// prettier-ignore
966966
<Line
967-
key={`yAxis-${anchor.value}--${index}`}
968-
strokeDasharray={handleLineType(anchor.lineStyle)}
969-
stroke={anchor.color ? anchor.color : 'rgba(0,0,0,1)'}
970-
className='anchor-y'
971-
from={{ x: runtime.yAxis.size, y: position - middleOffset }}
972-
to={{ x: runtime.yAxis.size + xMax, y: position - middleOffset }}
973-
/>
967+
key={`yAxis-${anchor.value}--${index}`}
968+
strokeDasharray={handleLineType(anchor.lineStyle)}
969+
stroke={anchor.color ? anchor.color : 'rgba(0,0,0,1)'}
970+
className='anchor-y'
971+
from={{ x: Number(runtime.yAxis.size), y: position - middleOffset }}
972+
to={{ x: Number(runtime.yAxis.size) + Number(xMax), y: position - middleOffset }}
973+
/>
974974
)
975975
})}
976976
{/* x anchors */}
@@ -1000,14 +1000,14 @@ const LinearChart = forwardRef<SVGAElement, LinearChartProps>(({ parentHeight, p
10001000
return (
10011001
// prettier-ignore
10021002
<Line
1003-
key={`xAxis-${anchor.value}--${index}`}
1004-
strokeDasharray={handleLineType(anchor.lineStyle)}
1005-
stroke={anchor.color ? anchor.color : 'rgba(0,0,0,1)'}
1006-
fill={anchor.color ? anchor.color : 'rgba(0,0,0,1)'}
1007-
className='anchor-x'
1008-
from={{ x: Number(anchorPosition) + Number(padding), y: 0 }}
1009-
to={{ x: Number(anchorPosition) + Number(padding), y: yMax }}
1010-
/>
1003+
key={`xAxis-${anchor.value}--${index}`}
1004+
strokeDasharray={handleLineType(anchor.lineStyle)}
1005+
stroke={anchor.color ? anchor.color : 'rgba(0,0,0,1)'}
1006+
fill={anchor.color ? anchor.color : 'rgba(0,0,0,1)'}
1007+
className='anchor-x'
1008+
from={{ x: Number(anchorPosition) + Number(padding), y: 0 }}
1009+
to={{ x: Number(anchorPosition) + Number(padding), y: yMax }}
1010+
/>
10111011
)
10121012
})}
10131013
{/* we are handling regions in bar charts differently, so that we can calculate the bar group into the region space. */}

0 commit comments

Comments
 (0)