import { ink } from './palette.ts' export interface LegendItem { label: string color: string /** stroke-dasharray for a line swatch */ dash?: string shape?: 'line' | 'dot' | 'cross' /** e.g. the max error for this series, shown after the label */ value?: string } /** * Identity is never carried by colour alone: every series that appears in a * plot appears here too, and the ones the reader most needs are also labelled * directly on the plot. */ export default function Legend({ items }: { items: LegendItem[] }) { return (
{items.map((it) => ( {it.label} {it.value && {it.value}} ))}
) }