Axes and scales
Categories, values, references and represented domains.
Domain data
Define stable category IDs or numeric/time axes as required by the chart contract. Core calculates scales and projection. Do not turn missing observations into zero or merge categories that share a visible label.
Presentation
options.axes controls grid, visibility and titles. Each axis accepts numberFormat and labels with maxLines, maxCharacters and rotation; full labels remain accessible. Ticks retain original Core values. Mixed charts support independent secondary-axis and tooltip formatting.
Value and date formatting
formatting.number configures fractions, currency, standard measurement units, percent, notation, grouping and signs. currencyDisplay selects symbol, code or name; currencySign supports accounting. formatting.locale selects regional formatting independently of UI language. Numeric X retains its independent measurement. Dates default to UTC. Currency/unit formatting does not convert values or change the original-data table or CSV.
import type { ChartOptions } from '@neural-charts/web';
export const options: ChartOptions = {
"title": "Revenue",
"locale": "en",
"formatting": {
"locale": "en-US",
"number": {
"style": "currency",
"currency": "EUR",
"minimumFractionDigits": 2,
"maximumFractionDigits": 2
}
}
};References
References use domain values rather than pixels. references defines value and axis; referenceStyles defines color, dash and width by the same ID; referenceLabels supplies text. Out-of-domain references are not drawn. The live lab compares a fixed target with a consumer-computed mean of original values from visible series.
const options = { references: [{ id: 'target', axis: 'y', value: 50 }], referenceStyles: [{ id: 'target', color: '#875310', dash: 'dashed', width: 1.5 }], referenceLabels: [{ id: 'target', text: 'Objetivo: 50' }] };Formatting precedence
For ordinary axes, an explicit value-axis numberFormat replaces the global number format, without mixing currency fields into units. Tooltips and data labels use their value-axis format. Secondary axes may have an independent format. Unsupported requested locales fall back to UI language, then English, rather than the server machine locale.
| Target | First choice | When omitted |
|---|---|---|
| Y | axes.y.numberFormat | formatting.number |
| Secondary Y | axes.secondaryY.numberFormat | formatting.number |
| Tooltip and data label | Corresponding value-axis format | formatting.number |
| Control language | locale | es / en |
| Number and date region | formatting.locale | Chart language, then English |
import type { ChartOptions } from '@neural-charts/web';
export const options: ChartOptions = {
"formatting": {
"number": {
"style": "currency",
"currency": "EUR"
}
},
"axes": {
"y": {
"title": "Distance",
"numberFormat": {
"style": "unit",
"unit": "kilometer",
"maximumFractionDigits": 1
}
}
}
};Original values and percentages
The primary axis of a percentage stack represents 0–100 and does not inherit currency or units from original values. Add the sign using decimal formatting with suffix: " %", without multiplying by one hundred again. Tooltips and data labels retain the global original-value format; a secondary axis retains its own format. References use the represented domain: an original monetary mean is not a percentage reference.
import type { ChartOptions } from '@neural-charts/web';
export const options: ChartOptions = {
"layout": {
"stacking": "percent"
},
"axes": {
"y": {
"numberFormat": {
"style": "decimal",
"suffix": " %",
"maximumFractionDigits": 0
}
}
},
"formatting": {
"number": {
"style": "currency",
"currency": "EUR"
}
}
};Defaults
Without formatting.number the library keeps its plain numeric presentation, up to12 significant digits. An empty number object activates Intl defaults. Currency requires an uppercase ISO code; unit requires a standard Intl-supported measurement unit. currencyDisplay defaults to symbol, currencySign to standard and unitDisplay to short. Currency fraction defaults depend on the currency; set minimumFractionDigits and maximumFractionDigits to fix them explicitly.