First chart
ts
import { createChart } from 'nervure';
const chart = createChart(document.querySelector('#chart')!, {
type: 'xy',
categories: ['Jan', 'Feb', 'Mar', 'Apr'],
legend: true,
series: [
{ name: 'This year', data: [12, 18, 25, 31] },
{ name: 'Last year', data: [10, 14, 20, 24], dashed: true },
],
});The host element must have a size; the chart follows it.
css
#chart { height: 300px; }Change it
ts
chart.update(nextSpec); // with the entrance animation
chart.refresh(nextSpec); // at once, for live data
chart.destroy(); // when you are doneOptions
ts
createChart(host, spec, { locale: 'en-GB', animate: false, theme: { font: 'Inter, sans-serif' } });