# Data (Chartist API)

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

## Meta

```ts
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

```ts
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

```ts
type NormalizedMulti = { x: number; y: number } | { x: number } | { y: number }
```

A [`Multi`](https://chartist.dev/api/data/#Multi) value after normalizing: its coordinates as numbers.

## Label

```ts
type Label = string | number | Date
```

A label of an axis step or a pie slice.

## AllSeriesTypes

```ts
type AllSeriesTypes = FlatSeries | (Series | SeriesObject)[]
```

Every shape `series` can take: a [`FlatSeries`](https://chartist.dev/api/data/#FlatSeries) (pies, distributed bars), or a list of [`Series`](https://chartist.dev/api/data/#Series) arrays and [`SeriesObject`](https://chartist.dev/api/data/#SeriesObject)s.

## Data

```ts
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

```ts
type Series<T = SeriesPrimitiveValue> = SeriesValue<T>[]
```

A series as an array of values: `[5, 2, 4]`. Use a [`SeriesObject`](https://chartist.dev/api/data/#SeriesObject) to give it a name, class name or meta.

## SeriesObject

```ts
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

```ts
type SeriesValue<T = SeriesPrimitiveValue> = SeriesObjectValue<T> | T
```

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

## SeriesPrimitiveValue

```ts
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`](https://chartist.dev/api/data/#Multi) `{ x, y }`, or `null` or `undefined` for a hole.

## SeriesObjectValue

```ts
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

```ts
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

```ts
type FlatSeriesValue<T = FlatSeriesPrimitiveValue> = SeriesValue<T> | FlatSeriesObjectValue<T>
```

A value of a [`FlatSeries`](https://chartist.dev/api/data/#FlatSeries): a plain value, `{ value, meta }`, or a [`FlatSeriesObjectValue`](https://chartist.dev/api/data/#FlatSeriesObjectValue) with a name and class name for its slice.

## FlatSeriesPrimitiveValue

```ts
type FlatSeriesPrimitiveValue = number | string | null | undefined
```

A plain value of a [`FlatSeries`](https://chartist.dev/api/data/#FlatSeries): a number (numeric strings are read as numbers), or `null` or `undefined` for a hole.

## FlatSeriesObjectValue

```ts
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

```ts
type AllNormalizedSeriesTypes = NormalizedFlatSeries | NormalizedSeries[]
```

Every shape a normalized `series` can take: a [`NormalizedFlatSeries`](https://chartist.dev/api/data/#NormalizedFlatSeries) or a list of [`NormalizedSeries`](https://chartist.dev/api/data/#NormalizedSeries).

## NormalizedData

```ts
interface NormalizedData<T extends AllNormalizedSeriesTypes = AllNormalizedSeriesTypes> extends Data
```

Chart data after [`normalizeData`](https://chartist.dev/api/helpers/#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

```ts
type NormalizedSeries = NormalizedSeriesValue[]
```

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

## NormalizedSeriesValue

```ts
type NormalizedSeriesValue = NormalizedSeriesPrimitiveValue
```

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

## NormalizedSeriesPrimitiveValue

```ts
type NormalizedSeriesPrimitiveValue = number | NormalizedMulti | undefined
```

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

## NormalizedFlatSeries

```ts
type NormalizedFlatSeries = number[]
```

A [`FlatSeries`](https://chartist.dev/api/data/#FlatSeries) after normalizing: one number per slice or bar.
