Skip to content

Commit 1923595

Browse files
committed
fix: fully hide legend symbol and clean tooltip for SKU charts
Add symbolHeight:0 alongside symbolWidth:0 to completely remove the colored dot/line from legend items. Use clean display name in tooltip pointFormatter instead of this.series.name which contains HTML markup.
1 parent c994ff4 commit 1923595

File tree

3 files changed

+11
-7
lines changed

3 files changed

+11
-7
lines changed

src/components/charts/CostBreakdownChart.tsx

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -87,7 +87,7 @@ export function CostBreakdownChart({ stackField = 'model', metricOptions }: Cost
8787
: '<tr style="border-top: 1px solid var(--borderColor-muted, #d1d9e0b3);"><td><b>Total:&nbsp;</b></td><td style="text-align: right;"><b>{point.total:,.0f}</b></td></tr></table>',
8888
},
8989
plotOptions: { column: { stacking: 'normal' } },
90-
...(stackField === 'sku' && { legend: { symbolWidth: 0, symbolPadding: 0 } }),
90+
...(stackField === 'sku' && { legend: { symbolWidth: 0, symbolHeight: 0, symbolPadding: 0 } }),
9191
series,
9292
};
9393
}, [activeReport, timeBucket, visibleRows, stackField, activeMetric, dataField]);

src/components/charts/ModelBreakdownChart.tsx

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -159,7 +159,7 @@ export function GroupBreakdownChart({ stackField = 'model', metricOptions }: Gro
159159
: '<tr style="border-top: 1px solid var(--borderColor-muted, #d1d9e0b3);"><td><b>Total:&nbsp;</b></td><td style="text-align: right;"><b>{point.total:,.0f}</b></td></tr></table>',
160160
},
161161
plotOptions: { bar: { stacking: 'normal' } },
162-
...(stackField === 'sku' && { legend: { symbolWidth: 0, symbolPadding: 0 } }),
162+
...(stackField === 'sku' && { legend: { symbolWidth: 0, symbolHeight: 0, symbolPadding: 0 } }),
163163
series,
164164
};
165165
}, [activeReport, groupByColumn, stackField, visibleRows, hiddenGroups, toggleGroup, activeMetric, dataField]);

src/components/charts/TimeSeriesChart.tsx

Lines changed: 9 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -133,11 +133,15 @@ export function TimeSeriesChart({ metricOptions }: { metricOptions?: MetricOptio
133133
break;
134134
}
135135

136+
const displayName = formatDisplayValue(group.key, groupByColumn) || ' ';
137+
const isSku = groupByColumn === 'sku';
138+
const icon = isSku ? getSkuIconSvg(group.key, color) : '';
139+
136140
series.push({
137141
type: 'line' as const,
138-
name: groupByColumn === 'sku'
139-
? `<span style="display:flex;align-items:center;gap:4px">${getSkuIconSvg(group.key, color)}${formatDisplayValue(group.key, groupByColumn) || ' '}</span>`
140-
: formatDisplayValue(group.key, groupByColumn) || ' ',
142+
name: icon
143+
? `<span style="display:flex;align-items:center;gap:4px">${icon}${displayName}</span>`
144+
: displayName,
141145
data: timestamps.map((t, j) => [t, chartData[j]] as [number, number]),
142146
color,
143147
...(smoothed && {
@@ -150,7 +154,7 @@ export function TimeSeriesChart({ metricOptions }: { metricOptions?: MetricOptio
150154
const formatted = activeMetric.isCurrency
151155
? `$${val.toLocaleString(undefined, { minimumFractionDigits: 2, maximumFractionDigits: 2 })}`
152156
: formatCompact(val);
153-
return `<span style="color:${this.color}">●</span> ${this.series.name}: <b>${formatted}</b><br/>`;
157+
return `<span style="color:${this.color}">●</span> ${displayName}: <b>${formatted}</b><br/>`;
154158
},
155159
},
156160
});
@@ -174,7 +178,7 @@ export function TimeSeriesChart({ metricOptions }: { metricOptions?: MetricOptio
174178
},
175179
},
176180
series,
177-
...(groupByColumn === 'sku' && { legend: { symbolWidth: 0, symbolPadding: 0 } }),
181+
...(groupByColumn === 'sku' && { legend: { symbolWidth: 0, symbolHeight: 0, symbolPadding: 0 } }),
178182
chart: { height: 400 },
179183
};
180184
}, [activeReport, groupByColumn, timeBucket, visibleRows, lineMode, rollingWindow, dataField, activeMetric]);

0 commit comments

Comments
 (0)