Filled holes in data
Series with missing values, bridged by a cardinal spline that fills the holes.
src/main.ts
import 'chartist/styles.css';
import { lineChart, Interpolation } 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
},
lineSmooth: Interpolation.cardinal({
fillHoles: true
}),
low: 0
}
);import 'chartist/styles.css';
import { LineChart, Interpolation } from 'chartist';
new 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
},
lineSmooth: Interpolation.cardinal({
fillHoles: true
}),
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.