Chartist

Search

Find a guide, an API entry or an example.

Try

Holes in data

Series with missing values, where each line breaks at every hole.

src/main.ts
import 'chartist/styles.css';
import { lineChart } from 'chartist';

lineChart(
  '#chart',
  {
    labels: [1, 2, 3, 4, 5, 6, 7, 8, 9, 10, 11, 12, 13, 14, 15, 16],
    series: [
      [5, 5, 10, 8, 7, 5, 4, null, null, null, 10, 10, 7, 8, 6, 9],
      [
        10,
        15,
        null,
        12,
        null,
        10,
        12,
        15,
        null,
        null,
        12,
        null,
        14,
        null,
        null,
        null
      ],
      [null, null, null, null, 3, 4, 1, 3, 4, 6, 7, 9, 5, null, null, null],
      [
        { x: 3, y: 3 },
        { x: 4, y: 3 },
        { x: 5, y: undefined },
        { x: 6, y: 4 },
        { x: 7, y: null },
        { x: 8, y: 4 },
        { x: 9, y: 4 }
      ]
    ]
  },
  {
    fullWidth: true,
    chartPadding: {
      right: 10
    },
    low: 0
  }
);
Live
Open in the playgroundView as MarkdownSwitch to 1.x above the code to see the same chart written with the Chartist 1.x classes.