@@ -12,7 +12,7 @@ import ChartYAxisLabels from '@components/Charts/components/ChartYAxisLabels';
1212import LeftFrameLine from '@components/Charts/components/LeftFrameLine' ;
1313import ScatterPoints from '@components/Charts/components/ScatterPoints' ;
1414import { AXIS_LABEL_GAP , CHART_CONTENT_MIN_HEIGHT , CHART_PADDING , GLYPH_PADDING , X_AXIS_LINE_WIDTH , Y_AXIS_LINE_WIDTH , Y_AXIS_TICK_COUNT } from '@components/Charts/constants' ;
15- import type { ComputeGeometryFn , HitTestArgs } from '@components/Charts/hooks' ;
15+ import type { HitTestArgs } from '@components/Charts/hooks' ;
1616import {
1717 useChartFontManager ,
1818 useChartInteractions ,
@@ -24,7 +24,7 @@ import {
2424 useYAxisLabelWidth ,
2525} from '@components/Charts/hooks' ;
2626import type { CartesianChartProps , ChartDataPoint } from '@components/Charts/types' ;
27- import { calculateMinDomainPadding , DEFAULT_CHART_COLOR , getAdditionalOffset , rotatedLabelYOffset } from '@components/Charts/utils' ;
27+ import { calculateMinDomainPadding , DEFAULT_CHART_COLOR } from '@components/Charts/utils' ;
2828import useTheme from '@hooks/useTheme' ;
2929import useThemeStyles from '@hooks/useThemeStyles' ;
3030import type { SkeletonSpanReasonAttributes } from '@libs/telemetry/useSkeletonSpan' ;
@@ -42,26 +42,6 @@ const MIN_SAFE_PADDING = DOT_RADIUS + DOT_HOVER_EXTRA_RADIUS;
4242/** Base domain padding applied to all sides */
4343const BASE_DOMAIN_PADDING = { top : 16 , bottom : 16 , left : 0 , right : 0 } ;
4444
45- /**
46- * Line chart geometry for label hit-testing.
47- * Labels are start-anchored at the tick: the 45° parallelogram's upper-right corner is
48- * offset by (iconSize/3 * sinA) left and down, placing the box just below the axis line.
49- */
50- const computeLineLabelGeometry : ComputeGeometryFn = ( { ascent, descent, sinA, angleRad, labelWidths, padding} ) => {
51- const iconThirdSin = ( variables . iconSizeExtraSmall / 3 ) * sinA ;
52- const additionalOffset = getAdditionalOffset ( angleRad ) ;
53- return {
54- labelYOffset : AXIS_LABEL_GAP + rotatedLabelYOffset ( ascent , descent , angleRad ) - additionalOffset ,
55- iconSin : variables . iconSizeExtraSmall * sinA ,
56- labelSins : labelWidths . map ( ( w ) => w * sinA ) ,
57- halfWidths : labelWidths . map ( ( w ) => w / 2 ) ,
58- cornerAnchorDX : labelWidths . map ( ( ) => - iconThirdSin ) ,
59- cornerAnchorDY : labelWidths . map ( ( ) => iconThirdSin ) ,
60- yMin90Offsets : labelWidths . map ( ( ) => padding ) ,
61- yMax90Offsets : labelWidths . map ( ( w ) => w + padding ) ,
62- } ;
63- } ;
64-
6545type LineChartProps = CartesianChartProps & {
6646 /** Callback when a data point is pressed */
6747 onPointPress ?: ( dataPoint : ChartDataPoint , index : number ) => void ;
@@ -139,7 +119,6 @@ function LineChartContent({data, isLoading, yAxisUnit, yAxisUnitPosition = 'left
139119 labelAreaWidth : plotAreaWidth ,
140120 firstTickLeftSpace : boundsLeft + domainPadding . left * paddingScale ,
141121 lastTickRightSpace : chartWidth > 0 ? chartWidth - boundsRight + domainPadding . right * paddingScale : 0 ,
142- allowTightDiagonalPacking : true ,
143122 measurements,
144123 } ) ;
145124
@@ -158,14 +137,12 @@ function LineChartContent({data, isLoading, yAxisUnit, yAxisUnitPosition = 'left
158137 labelRotation,
159138 labelSkipInterval,
160139 chartBottom,
161- computeGeometry : computeLineLabelGeometry ,
162140 } ) ;
163141
164142 const handleChartBoundsChange = ( bounds : ChartBounds ) => {
165143 setPlotAreaWidth ( bounds . right - bounds . left ) ;
166144 setBoundsLeft ( bounds . left ) ;
167145 setBoundsRight ( bounds . right ) ;
168- chartBottom . set ( bounds . bottom ) ;
169146 } ;
170147
171148 const checkIsOverDot = ( args : HitTestArgs ) => {
@@ -197,6 +174,8 @@ function LineChartContent({data, isLoading, yAxisUnit, yAxisUnitPosition = 'left
197174 } ) ) ;
198175
199176 const renderOutside = ( args : CartesianChartRenderArg < { x : number ; y : number } , 'y' > ) => {
177+ const chartBoundsBottom = args . yScale ( Math . min ( ...args . yTicks ) ) ;
178+ chartBottom . set ( chartBoundsBottom ) ;
200179 return (
201180 < >
202181 < LeftFrameLine
@@ -224,7 +203,7 @@ function LineChartContent({data, isLoading, yAxisUnit, yAxisUnitPosition = 'left
224203 fontMgr = { fontMgr }
225204 labelColor = { theme . textSupporting }
226205 xScale = { args . xScale }
227- chartBoundsBottom = { args . chartBounds . bottom }
206+ chartBoundsBottom = { chartBoundsBottom }
228207 />
229208 ) }
230209 { ! ! fontMgr && (
@@ -253,7 +232,7 @@ function LineChartContent({data, isLoading, yAxisUnit, yAxisUnitPosition = 'left
253232 fontMgr ,
254233 variables . iconSizeExtraSmall ,
255234 ) ;
256- const chartPadding = { ...CHART_PADDING , bottom : labelSpace + CHART_PADDING . bottom + variables . iconSizeExtraSmall , left : yAxisLabelWidth + GLYPH_PADDING } ;
235+ const chartPadding = { ...CHART_PADDING , bottom : labelSpace + CHART_PADDING . bottom , left : yAxisLabelWidth + GLYPH_PADDING } ;
257236
258237 if ( isLoading || ! fontMgr ) {
259238 const reasonAttributes : SkeletonSpanReasonAttributes = { context : 'LineChartContent' , isLoading, isFontLoading : ! fontMgr } ;
0 commit comments