@@ -102,15 +102,15 @@ function LineChartContent({data, title, titleIcon, isLoading, yAxisUnit, yAxisUn
102102 // How much space is wasted on each side
103103 const wastedLeft = geometricPadding - firstLabelNeeds ;
104104 const wastedRight = geometricPadding - lastLabelNeeds ;
105- const canReduce = Math . min ( wastedLeft , wastedRight ) ;
105+ const reclaimablePadding = Math . min ( wastedLeft , wastedRight ) ;
106106
107107 // Only reduce if both sides have excess space (labels short enough for 0°)
108- // If canReduce <= 0, labels are too long and hook will use rotation/truncation
109- const extraPadding = canReduce > 0 ;
110- const horizontalPadding = Math . max ( extraPadding ? geometricPadding - canReduce : geometricPadding , MIN_SAFE_PADDING ) ;
108+ // If reclaimablePadding <= 0, labels are too long and hook will use rotation/truncation
109+ const shouldUseExtraPadding = reclaimablePadding > 0 ;
110+ const horizontalPadding = Math . max ( shouldUseExtraPadding ? geometricPadding - reclaimablePadding : geometricPadding , MIN_SAFE_PADDING ) ;
111111
112- // if extraPadding is true then we have to add the extra padding to the right so the label is not clipped
113- return { ...BASE_DOMAIN_PADDING , left : horizontalPadding , right : horizontalPadding + ( extraPadding ? MIN_SAFE_PADDING : 0 ) } ;
112+ // If shouldUseExtraPadding is true then we have to add the extra padding to the right so the label is not clipped
113+ return { ...BASE_DOMAIN_PADDING , left : horizontalPadding , right : horizontalPadding + ( shouldUseExtraPadding ? MIN_SAFE_PADDING : 0 ) } ;
114114 } , [ chartWidth , data , font ] ) ;
115115
116116 // For centered labels, tick spacing is evenly distributed across the plot area (same as BarChart)
0 commit comments