Radiant Charts now offers two API styles. The Components API is the recommended default — it provides better type safety, discoverability, and a more idiomatic React authoring experience. The Options API remains fully supported with no breaking changes. This guide shows how to convert existing code.
<RadiantChart options={...}>) is not deprecated. It remains the best choice for dynamic dashboards, config-driven charts, and programmatic generation. You can mix both styles freely.The most common conversion: a chart with one series.
import { Chart, Bar } from 'radiant-charts';
<Chart data={data} height={400}>
<Bar xKey="month" yKey="revenue" fill="#6366f1" />
</Chart>Add multiple series children — each becomes one entry in the engine's series array.
import { Chart, Bar, Line, Legend } from 'radiant-charts';
<Chart data={data} height={400}>
<Legend position="top" />
<Bar xKey="month" yKey="revenue" title="Revenue" grouped />
<Line xKey="month" yKey="target" title="Target" stroke="#f59e0b" />
</Chart>Specialized chart types like <Candlestick> have typed props — TypeScript will enforce that openKey, highKey, lowKey, and closeKey are present.
import { Chart, Candlestick, Indicator } from 'radiant-charts';
<Chart data={ohlcData} height={500}>
<Candlestick
xKey="date"
openKey="open"
highKey="high"
lowKey="low"
closeKey="close"
/>
<Indicator type="SMA" period={20} sourceKey="close" stroke="#f59e0b" />
</Chart>Top-level options become either <Chart> props or dedicated child components:
import { Chart, Bar, XAxis, YAxis, Title, Legend } from 'radiant-charts';
<Chart data={data} theme="dark" height={400}>
<Title text="Quarterly Revenue" />
<XAxis fontSize={11} rotation={-45} />
<YAxis />
<Legend position="bottom" />
<Bar xKey="quarter" yKey="revenue" />
</Chart>Mapping from Options API fields to Components API equivalents:
| Options API | Components API |
|---|---|
options.data | <Chart data={...}> |
options.theme | <Chart theme="dark"> |
options.series[{ type, ...props }] | <Bar {...props} />, <Line {...props} />, etc. |
options.title | <Title text="..." /> |
options.subtitle | <Subtitle text="..." /> |
options.legend | <Legend position="top" /> |
options.showXAxis / xAxisFontSize | <XAxis show fontSize={11} /> |
options.showYAxis / yAxisFontSize | <YAxis show fontSize={11} /> |
options.crosshair | <Chart crosshair={{ x: true }}> |
options.zoom | <Chart zoom> |
options.navigator | <Chart navigator={{ enabled: true }}> |
options.tooltip | <Tooltip mode="shared" /> or <Chart tooltip={...}> |
options.indicators | <Indicator type="SMA" period={20} sourceKey="close" /> |
options.animation | <Chart animation={{ enabled: true, duration: 500 }}> |
options.annotations | <AnnotationMark type="line" value={50} /> |
ref.exportToPng() | <Chart chartRef={ref}> then ref.current.exportToPng() |
ChartDashboard and ChartDesigner work with serializable layout objects.useChart(options) hook returns a renderable element and its ref for composition in layout components.