import { EdElement } from '@brad-frost-web/eddie-web-components/components/EdElement.js';
export interface BarChartDataset {
label: string;
values: number[];
semantic?: 'positive' | 'negative' | 'neutral';
}
export interface BarChartData {
labels: string[];
datasets: BarChartDataset[];
}
/**
* Bar chart recipe — categorical data rendered with Chart.js 4.
*
* Themed via the tier-2 `--ed-theme-color-*-viz-*` token family (#654), with a
* fallback to `--ed-theme-color-background-accent-*` for older versions of
* `@brad-frost-web/eddie-design-tokens` that pre-date the viz block. Accessible
* baseline: a `role="img"` + `aria-label` region, plus a toggle-able linked
* data table that mirrors every plotted value.
*
* @use For comparing 3–20 discrete categories along one numeric dimension
* (monthly revenue, spend by department, project progress).
* @use For grouped or stacked comparison of 2–4 related series per category.
* @use When labels need to read like regular text (not dates or a continuum).
* @dontuse For time-series with a continuous temporal axis — use `ed-r-line-chart`.
* @dontuse For proportion-of-whole with ≤6 slices — use `ed-r-doughnut`.
* @dontuse For actual-versus-projected overlays — use `ed-r-projection`.
* @dontuse For more than ~20 categories — the chart becomes unreadable; use
* a sortable table or a filterable list instead.
* @a11y `chart-label` is required; it is announced as the chart region's
* accessible name and also becomes the caption of the linked data table.
* @a11y `dataTable` (default `true`) exposes every data point to assistive
* tech via a real `
` inside a `` toggle.
* @a11y `yFormat` is used for both tooltip labels and data-table cell values,
* so the announced text matches the visual formatting.
* @a11y Respects `prefers-reduced-motion` — disables chart animation.
* @a11y Keyboard navigation across individual bars and decal/pattern fills
* are not yet implemented — tracked on #656 as follow-up work.
*
*
* @anatomy A categorical bar chart (Chart.js 4) with vertical/horizontal orientation and grouped/stacked variants, plus a visually-hidden `dataTable` fallback.
*
* @related ed-r-line-chart — for continuous/time-series data instead of categories
* @related ed-r-doughnut — for parts-of-a-whole
* @related ed-table — the accessible data-table equivalent
* @related ed-r-projection — actual against expected; ed-r-stat-card — one or two headline numbers
*
* @content Bars for comparing categories; use horizontal when labels are long. Always supply `dataTable`; label axes via `yFormat`.
*
* @state `orientation` (vertical|horizontal) / `variant` (grouped|stacked). No interaction states beyond tooltips.
* @slot - Optional extended description (e.g., a trend callout) rendered
* between the chart and the data table.
*
* @recipe declarative
*
* @useWhen readers should see which of several categories leads, and by how much — teams, products, channels, answers to a survey
* @useWhen this year should sit beside last year for every category, or a total should show what it is made of
*
* @notWhen a measure is followed through continuous time and the rise and fall is the story — use `ed-r-line-chart`
* @notWhen the point is how a whole divides into a few shares — use `ed-r-doughnut`
* @notWhen what happened must be told apart from what is expected — use `ed-r-projection`
* @notWhen reading the exact figures is the main job, or there are more than twenty or so categories — use `ed-table`; the chart's own data table is a fallback for assistive technology, not the display
* @notWhen there are only one or two headline numbers — use `ed-r-stat-card`
*/
export declare class EdRBarChart extends EdElement {
/** Chart data — labels and one or more datasets with optional semantic hints. */
data: BarChartData;
/**
* Bar orientation: `vertical` (default) or `horizontal`.
*
* `vertical` when the categories have a natural order along the bottom — months, quarters,
* age bands — and their names are short. `horizontal` when the names are long, when more
* than about eight bars have no natural order, or when the bars are ranked from largest to
* smallest: a name reads along its bar instead of being tilted beneath it.
*/
orientation: 'vertical' | 'horizontal';
/**
* Multi-series layout: side-by-side (`grouped`, default) or layered (`stacked`).
*
* `grouped` when readers compare the series with one another inside a category — this
* year against last. `stacked` when the series are parts of a total and the total is what
* readers compare between categories; only the first series — the one against the axis —
* keeps a common baseline, so put the one that matters most there.
*/
variant: 'grouped' | 'stacked';
/** Accessible label for the chart region (required for a11y). */
chartLabel: string;
/** Render a toggle-able linked data table (default `true`). */
dataTable: boolean;
/** Formatter for numeric values — applied to ticks, tooltip, and data table. */
yFormat: (v: number) => string;
private canvas?;
private chart?;
private theme;
private unobserve?;
static get styles(): import('lit').CSSResult;
disconnectedCallback(): void;
firstUpdated(): void;
updated(changed: Map): void;
private createChart;
private toChartJsData;
private toChartJsOptions;
render(): import('lit-html').TemplateResult<1>;
private renderTable;
}
declare global {
interface HTMLElementTagNameMap {
'ed-r-bar-chart': EdRBarChart;
}
}
//# sourceMappingURL=bar-chart.d.ts.map