Skip to content

Commit f507195

Browse files
committed
fix(Legend): fix horisontal legend position
1 parent 63f5644 commit f507195

File tree

1 file changed

+2
-2
lines changed

1 file changed

+2
-2
lines changed

src/hooks/useSeries/prepare-legend.ts

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -236,7 +236,7 @@ function getLegendOffset(args: {
236236
case 'top':
237237
return {
238238
top: chartMargin.top,
239-
left: chartMargin.left,
239+
left: chartMargin.left + (chartWidth - legendWidth) / 2,
240240
};
241241
case 'right':
242242
return {
@@ -252,7 +252,7 @@ function getLegendOffset(args: {
252252
default:
253253
return {
254254
top: chartHeight - chartMargin.bottom - legendHeight,
255-
left: chartMargin.left,
255+
left: chartMargin.left + (chartWidth - legendWidth) / 2,
256256
};
257257
}
258258
}

0 commit comments

Comments
 (0)