File tree Expand file tree Collapse file tree 1 file changed +6
-2
lines changed
Expand file tree Collapse file tree 1 file changed +6
-2
lines changed Original file line number Diff line number Diff line change @@ -43,15 +43,16 @@ const getLegendItemPosition = (args: {
4343 align : PreparedLegend [ 'align' ] ;
4444 contentWidth : number ;
4545 width : number ;
46+ offsetLeft : number ;
4647} ) => {
47- const { align, width, contentWidth} = args ;
48+ const { align, width, contentWidth, offsetLeft } = args ;
4849
4950 if ( align === 'right' ) {
5051 return { left : width - contentWidth } ;
5152 } else if ( align === 'left' ) {
5253 return { left : 0 } ;
5354 } else {
54- return { left : width / 2 - contentWidth / 2 } ;
55+ return { left : offsetLeft + width / 2 - contentWidth / 2 } ;
5556 }
5657} ;
5758
@@ -351,7 +352,9 @@ export const Legend = (props: Props) => {
351352 align : legend . align ,
352353 width : config . maxWidth ,
353354 contentWidth,
355+ offsetLeft : config . offset . left ,
354356 } ) ;
357+
355358 left = legendLinePostion . left ;
356359 legendWidth = config . maxWidth ;
357360 break ;
@@ -395,6 +398,7 @@ export const Legend = (props: Props) => {
395398 align : legend . align ,
396399 width : config . maxWidth ,
397400 contentWidth : legend . width ,
401+ offsetLeft : config . offset . left ,
398402 } ) ;
399403 const { top} = getLegendPosition ( {
400404 width : config . maxWidth ,
You can’t perform that action at this time.
0 commit comments