Chartist

Search

Find a guide, an API entry or an example.

Try

Data

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

Meta

Source
type Meta = any

Anything you attach to a series or value as meta, such as a tooltip text. Chartist doesn't read it: it hands it back in events and writes it to the ct:meta attribute.

Multi

Source
type Multi = { x: number | string | Date | null; y: number | string | Date | null } | { x: number | string | Date | null } | { y: number | string | Date | null }

A value with coordinates: { x, y }, or only x or y. Line charts draw { x, y } values on two scale axes (scatter plots).

NormalizedMulti

Source
type NormalizedMulti = { x: number; y: number } | { x: number } | { y: number }

A Multi value after normalizing: its coordinates as numbers.

Label

Source
type Label = string | number | Date

A label of an axis step or a pie slice.

AllSeriesTypes

Source
type AllSeriesTypes = FlatSeries | (Series | SeriesObject)[]

Every shape series can take: a FlatSeries (pies, distributed bars), or a list of Series arrays and SeriesObjects.

Data

Source
interface Data<T extends AllSeriesTypes = AllSeriesTypes>

Chart data: the series, and labels for the positions of their values (or for the slices of a pie).

Properties

labels? Label[]

One label per value position: the steps of the X axis in line and bar charts, the slices in pie charts.

series T

The values: an array per series (or a series object with a name, class name and meta), or one flat array for pies and distributed bars.

Series

Source
type Series<T = SeriesPrimitiveValue> = SeriesValue<T>[]

A series as an array of values: [5, 2, 4]. Use a SeriesObject to give it a name, class name or meta.

SeriesObject

Source
interface SeriesObject<T = SeriesPrimitiveValue>

A series with a name, class name or meta: { name: 'Sales', data: [5, 2, 4] }.

Properties

name? string

The series' name. Line charts look up per-series options in series by it.

className? string

A class name for the series' group, instead of ct-series-a, -b, …

meta? any

Anything to attach to the series, handed back in events.

data SeriesValue<T>[]

The series' values.

SeriesValue

Source
type SeriesValue<T = SeriesPrimitiveValue> = SeriesObjectValue<T> | T

A value of a series: a plain value, or { value, meta }.

SeriesPrimitiveValue

Source
type SeriesPrimitiveValue = number | string | boolean | Date | Multi | null | undefined

A plain value of a series: a number (numeric strings are read as numbers), a Multi { x, y }, or null or undefined for a hole.

SeriesObjectValue

Source
interface SeriesObjectValue<T = SeriesPrimitiveValue>

A value with meta: { value: 5, meta: 'Tuesday' }.

Properties

meta? any

Anything to attach to the value, handed back in events.

value T

The value.

FlatSeries

Source
type FlatSeries<T = FlatSeriesPrimitiveValue> = FlatSeriesValue<T>[]

One flat array of values, one per slice or bar: the series of a pie chart, or of a bar chart with distributeSeries.

FlatSeriesValue

Source
type FlatSeriesValue<T = FlatSeriesPrimitiveValue> = SeriesValue<T> | FlatSeriesObjectValue<T>

A value of a FlatSeries: a plain value, { value, meta }, or a FlatSeriesObjectValue with a name and class name for its slice.

FlatSeriesPrimitiveValue

Source
type FlatSeriesPrimitiveValue = number | string | null | undefined

A plain value of a FlatSeries: a number (numeric strings are read as numbers), or null or undefined for a hole.

FlatSeriesObjectValue

Source
interface FlatSeriesObjectValue<T = FlatSeriesPrimitiveValue>

A value of a flat series that is its own series, such as a pie slice: { value: 20, name: 'Rent', className: 'rent' }.

Properties

name? string

The name of the value's series.

className? string

A class name for the value's series group, such as a slice's.

meta? any

Anything to attach to the value, handed back in events.

value T

The value.

AllNormalizedSeriesTypes

Source
type AllNormalizedSeriesTypes = NormalizedFlatSeries | NormalizedSeries[]

Every shape a normalized series can take: a NormalizedFlatSeries or a list of NormalizedSeries.

NormalizedData

Source
interface NormalizedData<T extends AllNormalizedSeriesTypes = AllNormalizedSeriesTypes> extends Data

Chart data after normalizeData: labels filled in, and every series an array of numbers, { x, y } numbers or holes.

Properties

labels Label[]

One label per value position, empty strings where none was given.

series T

The normalized series.

NormalizedSeries

Source
type NormalizedSeries = NormalizedSeriesValue[]

A series after normalizing: its values without meta or series object.

NormalizedSeriesValue

Source
type NormalizedSeriesValue = NormalizedSeriesPrimitiveValue

A normalized value: a number, { x, y } numbers, or undefined for a hole.

NormalizedSeriesPrimitiveValue

Source
type NormalizedSeriesPrimitiveValue = number | NormalizedMulti | undefined

A normalized value: a number, { x, y } numbers, or undefined for a hole.

NormalizedFlatSeries

Source
type NormalizedFlatSeries = number[]

A FlatSeries after normalizing: one number per slice or bar.