Chart

Alignment target:@astryxdesign/charts v0.1.9 · Chart

<Chart> props and slots #

<Chart> is the root container. It measures container dimensions, builds coordinate scales, calculates geometry positions, and renders the SVG tree.

Props #

NameTypeDefaultDescription
dataRecord<string, unknown>[]RequiredRows of data to render. Each row contains an x-axis field and one or more series fields.
xKeystringRequiredField name used as the x value across all series.
seriesSeriesDef[]RequiredArray of series definitions, rendered in order on a shared coordinate system.
heightnumber300Chart height in CSS pixels. Non-finite values and negative numbers are treated as 0.
widthnumber0Chart width in CSS pixels. Ignored after the browser first measures the container. Used during server-side rendering when no DOM container exists.
marginPartial<ChartMargin>{ top: 24, right: 24, bottom: 32, left: 48 }Partial margin overrides for the plotting area. Omitted sides use defaults.
yBaseline'auto' | 'zero' | 'data''auto'How to determine the y-axis domain when yDomain is not set.
yDomain[number, number]undefinedExplicit y-axis range [min, max]. When set, this range is used directly without baseline adjustments or edge padding.
xDomain[number, number]undefinedExplicit range [min, max] for numeric x-axes. Stays active even when data is empty, keeping streaming windows stable. Ignored on categorical band axes.
legendboolean | ChartLegendConfigfalseWhether to show the legend derived from series, or a configuration object to adjust position and alignment.
tooltipboolean | ChartTooltipConfigfalseWhether to show grouped hover tooltips.
titlestringundefinedChart title, used as the SVG accessible name.
subtitlestringundefinedSupporting text below the title, used as the SVG accessible description.

Slots #

NameBindingsDescription
gridNoneBackground grid rendered behind series, usually containing <ChartGrid />.
axesNoneAxes rendered behind series, usually containing one or more <ChartAxis /> components.
interactionsNoneCustom interaction layer rendered above the pointer capture surface.
tooltip{ xValue: unknown, rows: unknown[] }Custom tooltip slot. xValue is the active x value under the pointer. rows is the list of series data items for that row.
defaultNoneExtra content rendered after the built-in tooltip layer.