Builders
Builders add type-safe defaults and discriminants. They return plain objects.
tsx
import { Chart, zyplot } from '@hzblj/zyplot'
const chart = zyplot(z => ({
categories: ['Jan', 'Feb', 'Mar'],
series: [
z.series({
id: 'revenue',
label: 'Revenue',
values: [42, 56, 72],
style: { strokeWidth: 2 },
}),
],
yAxis: z.axis.end({ format: z.format({ prefix: '$' }) }),
animation: z.animation({ reveal: z.reveal.draw({ duration: 400 }) }),
}))
export function RevenueChart() {
return <Chart.Line {...chart} />
}Available builders
| Name | Type | Default | Description |
|---|---|---|---|
zyplot | chart config | — | Build a complete props object. |
series | ChartSeries | — | Build a styled series. |
annotation | annotation variants | — | Build line, point, range, text, or measure annotations. |
axis | axis variants | — | Place an axis at start, end, or over the plot. |
reveal | animation variants | — | Build draw, fade, or disabled reveal animation. |
marker | interaction variants | — | Build point, segment, or trail selection markers. |
options | plain objects | — | Create typed theme, surface, plot, fill, format, and interaction objects. |