Skip to content

Labels and notes ​

FieldWrites
heading, subheadingtext above the chart
xTitle, axes[].titleaxis titles
showLabelthe value of each point or bar
labelsyour own text for each value
labelAngleturned category names
format, axes[].formatevery number, or the numbers of one axis
linesa target, an average, a date
annotationsa note on a point

From code ​

ts
chart.addLine({ value: 60, label: 'Average' });
chart.addAnnotation({ at: 'Feb', value: 73, text: 'Holiday' });
chart.clearNotes();

Zones ​

A shaded zone marks a period (a forecast, a holiday) or a range of values (a target band), behind the series.

js
zones: [
  { from: 'Oct', to: 'Dec', label: 'Forecast' },
  { min: 80, max: 100, label: 'Target', color: '#2a9d8f' },
]

Gauges take several marks (target: [100, 90], the first one thicker) and progress bars a mark and a second line each (target, detail).

Your own elements ​

decorate receives the SVG: add a header or a watermark, which exports keep.

ts
{ ...spec, insetTop: 40, decorate: ({ svg, width, theme }) => { /* append elements */ } }