Chartist

Search

Find a guide, an API entry or an example.

Try

API reference

Every function and type Chartist exports, generated from its TypeScript source.

Reading the reference

The reference is generated from Chartist’s TypeScript source and its doc comments, so it always matches the version you install. It’s grouped by what you’re working on; the guides explain how the pieces fit together.

  • experimental May still change in a 2.x minor: live updates, new with 2.0, the server API of chartist/server, new with 2.1, and container(), which rests on a draft standard.
  • 1.x Kept so 1.x code runs unchanged. New code doesn’t need it.
  • Signatures link their types: click a type to see it.

Everything is exported from chartist, except the 1.x events, which come from chartist/compat, live updates, which come fromchartist/live, and rendering to markup, which comes from chartist/server.

Charts

lineChart, barChart and pieChart: a chart from data and options, with the 1.x options and output.

BarChartData LineChartData PieChartData BarChartPresetOptions BarPresetState barChartConfig barChart LineChartPresetOptions LinePresetState lineChartConfig lineChart PieChartPresetOptions PiePresetState pieChartConfig pieChart PresetState PresetHandle PresetAxisOptions PresetLayers PresetResponsiveOptions

chart()

The composable chart: data, axes and layers in one config, and the handle it returns.

chart ChartConfig ChartOverrides ChartHandle

Layers

What chart() draws: lines, bars, pies, grids and labels, each a layer over the same data.

AxisLayerClassNames AxisLayerOptions AxisLabelsOptions axisGrid axisLabels BandEdgeValue BandEdgeOption BandOptions band BarLayerOptions bar LineSeriesOptions LineLayerOptions line PieLayerOptions determineAnchorPosition pie Coordinates LayerContext ExtentContext Layer

Scales and axes

Axes that turn values into positions: step, auto-scaled and fixed, placed on any side.

AxisDimension AxisSide AxisContext AxisExtent AxisTransform ScaleAxis AxisFactory LegacyAxisClass AxisSetup AxisDefinition AxesConfig PlacedScaleAxis ChartAxes CartesianAxes cartesianAxes stepAxis autoScaleAxis fixedScaleAxis LabelAlign

Scene

The scene a chart composes before rendering: nodes, their roles and data, and how to find and change them.

AttrValue NodeContext NodeMeta SceneNodeFields SceneNodeMethods RoleNode PlainNode SceneNode RoleMeta node Point NoSeries SeriesContext SeriesGroupContext ValueContext PointContext BarContext PathContext SliceContext GridContext AxisLabelContext PieLabelContext BandEdge BandContext TextAttrs LineAttrs PathAttrs SeriesAttrs RectAttrs NodeRoles NodeRole NodeQuery findAll mapNodes

Events and plugins

The pipeline phases, their events and payloads, custom events, and the plugin shape.

ChartEvents CustomEventName ChartPlugin PluginWithOptions PluginEntry withOptions ChartData PreparedSeries PreparedData Area Layout NormalizedChartData InsetContext ResolvedConfig PhaseEvents RenderEvent PhaseName PhaseResult PhaseListener AllPhasesListener PhaseListeners

Rendering

From scene to output: renderers, text measuring, and rendering on the server.

SceneSize toScene seriesColors DomRenderOutput applyAttribute RenderElementOptions renderElement domRenderer TextMetrics LabelMode MeasureTextOptions MeasureText MeasureStyleOptions MeasureStyle textAscent estimateText RenderCause SceneChange Keyframes UpdateAnimation RenderUpdate RenderOutput Renderer

Responsive

Options that change with media queries or with the size of the chart’s container.

ContainerCondition ResponsiveCondition ResponsiveEntry container ResponsiveWatcher ResponsiveSet responsive

Data

The shapes of chart data: series, values, labels and meta, as given and as normalized.

Meta Multi NormalizedMulti Label AllSeriesTypes Data Series SeriesObject SeriesValue SeriesPrimitiveValue SeriesObjectValue FlatSeries FlatSeriesValue FlatSeriesPrimitiveValue FlatSeriesObjectValue AllNormalizedSeriesTypes NormalizedData NormalizedSeries NormalizedSeriesValue NormalizedSeriesPrimitiveValue NormalizedFlatSeries

SVG and animation

The small SVG toolkit behind the charts: elements, paths, SMIL animations, easings and line interpolation.

Interpolation Svg SvgList SvgPath easings keySplinesOf sampleEasing BasePathParams MoveParams LineParams CurveParams ArcParams PathParams PathCommand SvgPathOptions Attributes AnimationDefinition AnimationEvent

chartist/compat

The 1.x events (data, draw, created, …) and 1.x plugins on the functional API.

compat fromLegacyPlugin AreaDrawEvent AxesDrawEvent BarChartCreatedEvent BarDrawEvent CreatedEvent DataEvent DrawEvent GridBackgroundDrawEvent GridDrawEvent LabelDrawEvent LineChartCreatedEvent LineDrawEvent OptionsChangedEvent PieChartCreatedEvent Plugin PointDrawEvent SliceDrawEvent SliceLabelDrawEvent

chartist/live

Live updates: the renderer that changes a chart’s SVG in place, the keyed diff, and SMIL update animations.

smilAnimations diffScenes liveDomRenderer ValueKeyContext ValueKey DiffOptions LiveAnimationContext LiveAnimations LiveDomRendererOptions

chartist/server

Charts as markup without a DOM: SVG strings, markup the browser takes over, and stylesheets written into the SVG for images and PDFs.

ComputedStyles SkippedStyle ComputeStylesOptions ApplyStylesOptions computeStyles applyStyles SkipReason toScene SceneSize renderForHydration renderToString

1.x classes

LineChart, BarChart and PieChart as in 1.x, with their options, axis classes, events and drawing helpers. Deprecated, and removed from chartist in 3.0: new code uses the chart functions.

AutoScaleAxis Axis FixedScaleAxis StepAxis AxisType BarChart BarChartOptions BarChartOptionsWithDefaults BarChartCreatedEvent BarDrawEvent BarChartEventsTypes BaseChart getSeriesOption LineChart LineInterpolation LineChartOptions LineChartOptionsWithDefaults LineChartCreatedEvent PointDrawEvent LineDrawEvent AreaDrawEvent LineChartEventsTypes PieChart LabelDirection AnchorPosition RadialLabelPosition Dot PieChartOptions PieChartOptionsWithDefaults PieChartCreatedEvent SliceDrawEvent SliceLabelDrawEvent PieChartEventsTypes BaseChartEventsTypes createSvg createGrid createGridBackground createLabel OptionsProvider optionsProvider ChartPadding Plugin Options AxisOptions OptionsWithDefaults ResponsiveOptions CreatedEvent DrawEvent DataEvent OptionsChangedEvent GridDrawEvent GridBackgroundDrawEvent LabelDrawEvent AxesDrawEvent EventListener AllEventsListener EventEmitter

Helpers

The data, math and utility functions the charts are built from, for plugins and custom layers.

axisUnits XAxisUnits YAxisUnits AxisUnits namespaces precision escapingMap normalizePadding createChartRect getBounds getMetaData isDataHoleValue isArrayOfSeries isMultiValue getMultiValue getHighLow normalizeData splitIntoSegments serialize deserialize ensureUnit quantity alphaNumerate EPSILON orderOfMagnitude projectLength roundWithPrecision rho polarToCartesian ChartRect ViewBox Bounds Segment SegmentData AxisName extend noop times sum serialMap FilterByKey RequiredKeys safeHasProperty isNumeric isFalseyButZero getNumberOrUndefined isArrayOfArrays each