Skip to content

Commit e6b46b5

Browse files
committed
fix(timeseries): cap the percent-change baseline to the plot area
The handle spanned the full chart height, running through the legend and x-axis labels; it now uses the grid's actual rect, falling back to full height if the internal API is unavailable. Co-Authored-By: Claude Opus 4.8 (1M context) <noreply@anthropic.com>
1 parent 17d489a commit e6b46b5

1 file changed

Lines changed: 25 additions & 1 deletion

File tree

‎superset-frontend/plugins/plugin-chart-echarts/src/Timeseries/EchartsTimeseries.tsx‎

Lines changed: 25 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -127,7 +127,31 @@ export default function EchartsTimeseries({
127127
};
128128

129129
const drawHandle = () => {
130-
const gridRect = { top: 0, height: chart.getHeight() };
130+
// Cap the handle to the plot area so it doesn't run through the
131+
// legend above or the axis labels below.
132+
let gridRect = { top: 0, height: chart.getHeight() };
133+
try {
134+
const rect = (
135+
chart as unknown as {
136+
getModel: () => {
137+
getComponent: (
138+
type: string,
139+
index: number,
140+
) => {
141+
coordinateSystem: {
142+
getRect: () => { y: number; height: number };
143+
};
144+
};
145+
};
146+
}
147+
)
148+
.getModel()
149+
.getComponent('grid', 0)
150+
.coordinateSystem.getRect();
151+
gridRect = { top: rect.y, height: rect.height };
152+
} catch {
153+
// fall back to the full chart height
154+
}
131155
let px: number;
132156
try {
133157
[px] = [chart.convertToPixel({ xAxisIndex: 0 }, baselineX) as number];

0 commit comments

Comments
 (0)