1π
β
In Chart.js 3.x, steppedLine
property was changed to stepped
.
const data = {
labels: ['Day 1', 'Day 2', 'Day 3', 'Day 4', 'Day 5', 'Day 6'],
datasets: [
{
label: 'Dataset',
data: Utils.numbers({count: 6, min: -100, max: 100}),
borderColor: Utils.CHART_COLORS.red,
fill: false,
// Change the stepped mode to explore different stepped chart options
// false: no stepping
// true: stepped before interpolation
// 'before': step before interpolation
// 'after': step after interpolation
// 'middle': step middle interpolation
stepped: true
}
]
};
1π
Check out the examples of Chartjs on Github, multiple stepped line chart examples included β https://github.com/chartjs/Chart.js/blob/master/samples/charts/line/stepped.html
The example from there recreated on Codepen β https://codepen.io/Inlesco/pen/yXEvOz
The configs for steppedLine
on each chart in the Codepen example are defined in small chunks such as:
{
steppedLine: true,
label: 'No Step Interpolation',
color: window.chartColors.red
}
Source:stackexchange.com