@@ -1125,24 +1125,11 @@ export default function transformProps(
11251125 name,
11261126 icon : 'roundRect' ,
11271127 } ) ) ;
1128- const nonLegendPadding = getPadding (
1129- false ,
1130- legendOrientation ,
1131- addYAxisLabelOffset ,
1132- zoomable ,
1133- undefined ,
1134- addXAxisLabelOffset ,
1135- yAxisTitlePosition ,
1136- convertInteger ( yAxisTitleMargin ) ,
1137- convertInteger ( xAxisTitleMargin ) ,
1138- isHorizontal ,
1139- ) ;
1140- const nonLegendReservedHeight =
1141- nonLegendPadding . top +
1142- ( isHorizontal ? nonLegendPadding . left : nonLegendPadding . bottom ) ;
1128+ const isSmallChart = height < TIMESERIES_CONSTANTS . compactChartHeight ;
1129+ const isLegendVisible = showLegend && ! isSmallChart ;
11431130 const getLegendLayout = ( candidateLegendMargin ?: string | number | null ) => {
11441131 const padding = getPadding (
1145- showLegend ,
1132+ isLegendVisible ,
11461133 legendOrientation ,
11471134 addYAxisLabelOffset ,
11481135 zoomable ,
@@ -1172,9 +1159,9 @@ export default function transformProps(
11721159 ? colorByPrimaryAxisLegendData
11731160 : sortedLegendData ,
11741161 legendMargin : candidateLegendMargin ,
1175- nonLegendReservedHeight,
11761162 orientation : legendOrientation ,
1177- show : showLegend ,
1163+ reserveFullHorizontalPlainLegendMargin : true ,
1164+ show : isLegendVisible ,
11781165 showSelectors : ! ( colorByPrimaryAxis && groupBy . length === 0 ) ,
11791166 theme,
11801167 type : legendType ,
@@ -1189,7 +1176,7 @@ export default function transformProps(
11891176 : initialLegendLayout ;
11901177 const { effectiveLegendType } = legendLayout ;
11911178 const hasHorizontalPlainLegend =
1192- showLegend &&
1179+ isLegendVisible &&
11931180 effectiveLegendType === LegendType . Plain &&
11941181 ( legendOrientation === LegendOrientation . Top ||
11951182 legendOrientation === LegendOrientation . Bottom ) ;
@@ -1200,7 +1187,7 @@ export default function transformProps(
12001187 ? legendMargin
12011188 : legendLayout . effectiveLegendMargin ;
12021189 const padding = getPadding (
1203- showLegend ,
1190+ isLegendVisible ,
12041191 legendOrientation ,
12051192 addYAxisLabelOffset ,
12061193 zoomable ,
@@ -1334,7 +1321,6 @@ export default function transformProps(
13341321 // >= 100px: full axis with proportional tick count
13351322 // 60-99px: show only min/max boundary labels (splitNumber=1), hide lines/ticks
13361323 // < 60px: hide all axis decorations, show line only
1337- const isSmallChart = height < TIMESERIES_CONSTANTS . compactChartHeight ;
13381324 const isMicroChart = height < TIMESERIES_CONSTANTS . microChartHeight ;
13391325 const yAxisSplitNumber = isMicroChart
13401326 ? undefined
@@ -1545,7 +1531,7 @@ export default function transformProps(
15451531 effectiveLegendType ,
15461532 legendOrientation ,
15471533 // Hide legend on compact charts — not enough vertical space
1548- isSmallChart ? false : showLegend ,
1534+ isLegendVisible ,
15491535 theme ,
15501536 zoomable ,
15511537 legendState ,
0 commit comments