/**
* Local chart variants for the stats/debris/reentries pages (pure SVG, server-safe).
* Same visual system as `@/components/charts/charts` — hairline axes, mono tick labels, token colours.
*/
import { max as d3max } from 'd3-array';
import { scaleLinear } from 'd3-scale';
import { cn } from '@/lib/cn';
import { fmtCompact } from '@/lib/format';
export interface MultiBin {
bin: number;
values: number[];
}
/**
* Grouped histogram: several series drawn side-by-side inside each bin (e.g. active payloads vs debris per 25 km).
* `series` = labels + colours in the same order as `values`.
*/
export function GroupedHistogram({ data, series, className, height = 170, title, unit = '', xTicks = 8 }: { data: MultiBin[]; series: { label: string; color: string }[]; className?: string; height?: number; title: string; unit?: string; xTicks?: number }) {
if (!data.length || !series.length) {
return (