Skip to content

Commit 682b457

Browse files
committed
Fix for adding series color being out of sync with the graph
1 parent 3c0644a commit 682b457

File tree

1 file changed

+4
-2
lines changed

1 file changed

+4
-2
lines changed

apps/webapp/app/components/code/QueryResultsChart.tsx

Lines changed: 4 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -889,13 +889,15 @@ export const QueryResultsChart = memo(function QueryResultsChart({
889889
const cfg: ChartConfig = {};
890890
sortedSeries.forEach((s, i) => {
891891
const statusColor = groupByIsRunStatus ? getRunStatusHexColor(s) : undefined;
892+
const originalIndex = config.yAxisColumns.indexOf(s);
893+
const colorIndex = originalIndex >= 0 ? originalIndex : i;
892894
cfg[s] = {
893895
label: s,
894-
color: statusColor ?? config.seriesColors?.[s] ?? getSeriesColor(i),
896+
color: statusColor ?? config.seriesColors?.[s] ?? getSeriesColor(colorIndex),
895897
};
896898
});
897899
return cfg;
898-
}, [sortedSeries, groupByIsRunStatus, config.seriesColors]);
900+
}, [sortedSeries, groupByIsRunStatus, config.seriesColors, config.yAxisColumns]);
899901

900902
// Custom tooltip label formatter for better date display
901903
const tooltipLabelFormatter = useMemo(() => {

0 commit comments

Comments
 (0)