Skip to content

Config reference

The reference has three parts:

  • Config sections — this page and the pages it links to, one per section of a mochart config (chart, series, categoryAxis, …): every property, its rules, and its default. Generated from the library source — the same descriptions, validators, and defaults that power config validation produce these pages, so they cannot drift from the code.
  • Props and callbacks — what a chart instance takes, as opposed to what its config says: Chart props (sizing, loading/error, controlled focus and filtering, the state factories), Callbacks and payloads, and the name each framework binding gives those props in Framework props. Generated from the packages' type declarations.
  • API — the functions and classes @mochart/core exports: the entry points and ChartHandle, the data providers, the config and chart helpers, constants, and mochartCssClasses. The literal types behind the enumerated config values (RendererType, CurveType, …) have their own generated page, Enumerated values.

Config sections

A mochart config is a plain object made of per-concern sections. Every section — and almost every property inside one — is optional and falls back to a sensible default, so a minimal config only names the data properties to plot (see Getting started).

The list sections (series, valueAxes, seriesGroups, seriesStacks, linearGradients, radialGradients, patterns) take an array of config objects and have a companion *Defaults section for values shared by every entry — see The config model for how sharing and defaulting work. id and version are the only top-level keys that are not sections.

PropertyDescriptionDefault
accessibilityConfigure the chart accessibility features and screen-reader labels {}
animationConfigure the chart animation settings {}
categoryAxisConfigure the chart category axis content and styling {}
chartConfigure general settings of the chart {}
clipIndicatorConfigure the band marking plot edges that have data hidden behind them (applies when chart.type is xy) {}
colorPaletteConfigure the color palettes to use for collections of series {}
crosshairConfigure the crosshair styling and behavior when a category and/or series is focused (applies when chart.type is xy) {}
idAn optional identifier for the config (any value; the chart only compares it — a changed id resets the chart)
legendConfigure the chart legend which itemizes the series {}
linearGradients
linearGradientDefaults
Configure linear gradients to be applied to series
Configure common properties for all linear gradients
[]
patterns
patternDefaults
Configure built-in patterns to be applied to series fills
Configure common properties for all patterns
[]
pieConfigure the pie/donut slice geometry and slice labels (applies when chart.type is pie) {}
plotConfigure the chart plot content and styling {}
radialGradients
radialGradientDefaults
Configure radial gradients to be applied to series
Configure common properties for all radial gradients
[]
series
seriesDefaults
Configure the chart series
Configure common properties for all series
[]
seriesGroups
seriesGroupDefaults
Configure the grouping of series
Configure common properties for all series groups
[]
seriesStacks
seriesStackDefaults
Configure the stacking of series
Configure common properties for all series stacks
[]
titleConfigure the chart title {}
tooltipConfigure the chart tooltip styling and behavior {}
valueAxes
valueAxisDefaults
Configure the chart value axes content and styling
Configure common properties for all value axes
[]
versionThe version of the configuration format (optional: omitted means the current format; include it in stored or shared configs so future releases can migrate them)

Released under the MIT License.