Skip to content

Commit 8787839

Browse files
committed
fix: tooltip header shows category name instead of numeric index
this.x in Highcharts bar chart formatter returns the numeric category index, not the category string. Use point.category or look up from the categories array instead.
1 parent f826fbb commit 8787839

1 file changed

Lines changed: 4 additions & 4 deletions

File tree

src/components/charts/ModelBreakdownChart.tsx

Lines changed: 4 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -148,12 +148,12 @@ export function GroupBreakdownChart({ stackField = 'model', metricOptions }: Gro
148148
useHTML: true,
149149
formatter: function () {
150150
// eslint-disable-next-line @typescript-eslint/no-explicit-any
151-
const pt = this as unknown as { point: { y: number; total: number; color: string }; series: { name: string; userOptions?: { custom?: { rawStack?: string } } }; x: string };
151+
const pt = this as unknown as { point: { y: number; total: number; color: string; category?: string; index: number }; series: { name: string; userOptions?: { custom?: { rawStack?: string } } }; x: number };
152152
const val = pt.point.y ?? 0;
153153
const total = pt.point.total ?? val;
154-
// Header: groupBy entity with icon
155-
const key = String(pt.x ?? '');
156-
const rawKey = sorted.find((s) => formatDisplayValue(s.key, groupByColumn) === key)?.key ?? key;
154+
// Header: groupBy entity with icon (pt.x is numeric index, use category name)
155+
const key = pt.point.category ?? categories[pt.x] ?? String(pt.x);
156+
const rawKey = sorted[pt.x]?.key ?? key;
157157
const headerIcon = columnHasIcons(groupByColumn) ? getGroupIconSvg(rawKey, groupByColumn) : '';
158158
const headerHtml = headerIcon
159159
? `<span style="display:inline-flex;align-items:center;gap:4px;">${headerIcon}${key}</span>`

0 commit comments

Comments
 (0)