1.6 KiB
1.6 KiB
046 — Squash bars/legend entries when a chart has too many series
Summary
webapp/src/components/PanelChart.tsx renders one bar (BarChart, lines
103-119) or slice (PieChart, lines 122-145) per PromqlSeries, labeled via
seriesLabel() (lines 18-23) and colored by cycling through a fixed
8-color palette COLORS (line 26). There is no "top N + other" grouping,
bar-squashing, or legend simplification anywhere in this file — with many
series/labels, both charts render an unbounded number of bars/legend rows
and repeat colors once the palette wraps.
Scope
- Define a threshold above which a panel's series count is considered "too many" (bars and legend entries alike).
- Above the threshold, squash extra bars into an aggregated "other" bucket (or equivalent visual simplification) rather than rendering one bar per series.
- Above the threshold, simplify the legend similarly (e.g. collapse to top-N + "other", or a compact/paginated legend) instead of listing every series.
- Apply the same treatment consistently across all chart types in
PanelChart.tsxthat can have many series (bar, pie), not just one.
Acceptance criteria
- A panel with a large number of series (seeded fixture) renders a bounded number of bars/legend entries instead of one per series, with an "other"/aggregate representation for the rest.
- A panel with few series is visually unchanged from current behavior.
- Color assignment no longer visibly repeats for panels within the squashed range (i.e. squashing keeps the rendered series count within the palette size, or palette collisions are otherwise addressed).
Depends on
None.