Data and options
Stable identity, immutable inputs and explicit configuration.
data describes what you know
Data contains the chart type, categories, series and observations. Timeline event titles are event content. Scatter retains numeric XY pairs. null means a missing measurement; zero remains a real value. A category’s visible label does not replace its ID.
options describes presentation
Title, theme, colors, axes, layout, legend and tooltip belong in options. Specialized variants expose typed configuration: column orientation/stacking, Contour levels and WordCloud packing parameters. Core validates their constraints.
Update
update replaces data and updateOptions applies the complete options object. Explicitly retain any groups and fields you want to keep. If an update fails, the result contains a diagnostic and the last valid chart remains in place.
| Configure | Responsibility | Rule |
|---|---|---|
| data | Your application | New object; retain IDs for the same data. |
| options | Your application | updateOptions receives the complete object. |
| selectedPoints / hiddenSeriesIds | Controlled when you supply the value | Accept proposals by updating that value. |
| viewport.value | Controlled when you supply the value | Do not maintain two applied viewport states. |
import type { ChartController, ChartOptions } from '@neural-charts/web';
export function setHeight(chart: ChartController, applied: ChartOptions, height: number) {
const next: ChartOptions = { ...applied, height };
const result = chart.updateOptions(next);
if (result.status === 'invalid') throw new Error(result.diagnostic.message);
return next;
}Business objects
Keep business objects outside the chart and retrieve them through seriesId and pointId. Interaction does not depend on a DOM node or the object identity of reconstructed input.
Chart language
options.locale changes the chart’s own messages, controls, help and accessible table between English and Spanish. Your application translates titles, series names, categories, references and affixes while preserving IDs. formatting.locale independently selects regional number and date formatting; it does not translate business content.
import type { ChartOptions } from '@neural-charts/web';
export const options: ChartOptions = {
"locale": "es",
"formatting": {
"locale": "de-DE",
"number": {
"style": "currency",
"currency": "EUR"
}
},
"title": "Ingresos"
};