export type LegendMode = 'threshold' | 'continuous' | 'diverging' | 'categorical' | 'proportional-symbols'; /** A formatter that turns a numeric value into a display string. */ export type LegendFormatter = (value: number) => string; /** * A threshold/diverging bin. Define at least one of `from`/`to`. Colors are * passed through directly, so use any CSS color or design token. */ export interface LegendItem { /** CSS color for the bin or category swatch. */ color: string; /** Lower bound of the bin (inclusive). Omit for an open-ended first bin. */ from?: number | null; /** Upper bound of the bin (exclusive). Omit for an open-ended last bin. */ to?: number | null; /** Optional explicit label. Generated from the bounds when omitted. */ label?: string; } /** A continuous gradient stop. */ export interface LegendStop { /** Numeric position of the stop along the domain. */ value: number; /** CSS color at this stop. */ color: string; /** Optional explicit label. */ label?: string; } /** A continuous-mode axis tick. */ export interface LegendTick { /** Numeric position of the tick along the domain. */ value: number; /** Optional explicit label. Formatted from `value` when omitted. */ label?: string; } /** The highlighted center of a diverging legend. */ export interface LegendMidpoint { /** Numeric value of the midpoint within the legend domain. */ value: number; /** Optional explicit label. Formatted from `value` when omitted. */ label?: string; } /** A proportional-symbols entry. */ export interface LegendSymbolItem { /** Non-negative numeric value mapped to circle area. */ value: number; /** Optional explicit label. Formatted from `value` when omitted. */ label?: string; } /** Fallback swatch for missing/unknown values. */ export interface LegendNoData { /** Label shown next to the fallback swatch. */ label: string; /** Optional CSS color for the fallback swatch. */ color?: string; } import type { ContainerWidth } from '../@types/global'; interface Props { /** Optional legend heading displayed above the scale. */ title?: string; /** Optional subtitle displayed beneath the title. */ subtitle?: string; /** Legend rendering mode. */ mode?: LegendMode; /** * Legend entries. Threshold/diverging modes use numeric bounds and colors; * categorical mode uses label and color pairs; proportional-symbols mode * uses numeric values and optional labels. */ items?: LegendItem[] | LegendSymbolItem[]; /** Ordered continuous color stops with numeric values. */ stops?: LegendStop[]; /** Optional tick values and labels for continuous mode. */ ticks?: LegendTick[]; /** Diverging midpoint with a numeric value and optional label. */ midpoint?: LegendMidpoint | null; /** Optional formatter applied to numeric values. */ formatter?: LegendFormatter | null; /** Optional fallback swatch for missing values. */ noData?: LegendNoData | null; /** Width of the legend within the text well. */ width?: ContainerWidth; } /** * A presentational legend for maps and charts in one of five modes: threshold, continuous, diverging, categorical or proportional symbols. * * [Read the docs.](https://reuters-graphics.github.io/graphics-components/?path=/docs/components-graphics-legend--docs) */ declare const Legend: import("svelte").Component; type Legend = ReturnType; export default Legend;