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.

currency.ts
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.

Example
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' }] };

Try all five templates and export →

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.

Formatting resolution order
TargetFirst choiceWhen omitted
Yaxes.y.numberFormatformatting.number
Secondary Yaxes.secondaryY.numberFormatformatting.number
Tooltip and data labelCorresponding value-axis formatformatting.number
Control languagelocalees / en
Number and date regionformatting.localeChart language, then English
axis-format.ts
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.

percent-axis.ts
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.

Troubleshooting