{labelFormatter(label)}
- {payload.map((p, i) => (
-
-
- {p.name ?? p.dataKey}
- {valueFormatter(p.value)}
-
- ))}
+ {payload.map((p, i) => {
+ const field = String(p.dataKey ?? p.name ?? "");
+ const color = seriesColors?.[field] ?? p.color ?? p.fill ?? "var(--dac-accent)";
+ return (
+
+
+ {p.name ?? p.dataKey}
+ {valueFormatter(p.value)}
+
+ );
+ })}
);
}
+interface LegendPayloadEntry {
+ color?: string;
+ value?: string;
+ dataKey?: string;
+}
+
+function CustomLegend({
+ payload,
+ seriesStyles,
+ chartType,
+ seriesColors,
+ seriesModes,
+}: {
+ payload?: LegendPayloadEntry[];
+ seriesStyles?: SeriesStyles;
+ chartType?: Widget["chart"];
+ seriesColors?: Record