Askr
UI & Components

Migration from Charts 0.1

Use migration from charts 0.1 with the current published Askr packages.

  • @askrjs/askr0.0.59

How to use migration from charts 0.1

Create a typed plot factory once, give the root stable row data, and compose only the scales, marks, and interactions the chart needs.

  1. Import the published @askrjs/askr entrypoint.
  2. Keep migration from charts 0.1 configuration next to the component, route, or server composition root that owns it.
  3. Handle pending, unavailable, cancellation, and failure states, then verify the production path.
import { createPlot } from '@askrjs/charts';

const Plot = createPlot<ProjectRow>();

<Plot.Root data={rows} rowKey={(row) => row.id} label="Revenue by day">
  <Plot.Axis axis="x" />
  <Plot.Axis axis="y" />
  <Plot.Line x="createdAt" y="revenue" />
</Plot.Root>

Package baseline

0.1 is a clean break: there is no `components`, `core`, `default`, per-chart CSS, template, or generator entrypoint left as a compatibility shim. Everything JavaScript comes from the root `@askrjs/charts` export, and structural/theme styles come from the separate `@askrjs/charts/styles` import — both need to be wired up, since neither substitutes for the other.

Plot model

Per-chart components like `BarChart`, `LineChart`, `AreaChart`, `DonutChart`, `PieChart`, and `StackedBarChart` are gone; they're replaced by composing primitives under one `createPlot<Row>()` factory — `Plot.Bar`, `Plot.Line`, `Plot.Area`, and `Plot.Arc` with the right radius or stack options. `Sparkline` becomes a compact `Root` with `Line` or `Area`; `Heatmap` becomes `Cell`; `Timeline` becomes `Rule`, `Point`, and `Text` together; `FlameGraph` becomes `Rect` driven by `partition(...)`.

View state

Where the old catalog managed pan, zoom, and selection internally per chart type, 0.1 exposes `view`/`onViewChange`/`defaultView` and `selection`/`onSelectionChange`/`defaultSelection` uniformly on `Root` for every mark family. `ChartEmptyState` is replaced by `Root`'s `empty` prop, while loading and error states stay owned by the route rather than the plot.

Export and interaction

`ChartLegend` is replaced by the `Legend` primitive, and export functionality that used to be bolted onto individual chart components now comes from `PlotApi` (`exportPng`, `exportSvg`, `exportData`) delivered through `Root`'s `onApiChange`. `ChartShell` and `ChartPanel` have no direct replacement — keep card and page chrome in the application and let `Plot.Root`'s `title`/`description` own only the plot's own semantic heading.