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

NameTypeDefaultDescription
zyplotchart config—Build a complete props object.
seriesChartSeries—Build a styled series.
annotationannotation variants—Build line, point, range, text, or measure annotations.
axisaxis variants—Place an axis at start, end, or over the plot.
revealanimation variants—Build draw, fade, or disabled reveal animation.
markerinteraction variants—Build point, segment, or trail selection markers.
optionsplain objects—Create typed theme, surface, plot, fill, format, and interaction objects.