4👍
Use the spanGaps
option:
var t = ['January', 'February', 'March', 'April', 'May', 'June'];
var vals = [1,null,null,5,null,1];
var chartdata ={
labels:t,
datasets :[
{
data:vals,
spanGaps: true
}
]
};
var ctx = document.getElementById("mycanvas").getContext('2d');
var lineGraph = new Chart(ctx,{
type: 'line',
data: chartdata
});
Note: You may need to experiment with the line tension and y-axis min and max to get it looking the way you want but this should meet your basic requirements.
- [Chartjs]-Line chart with large number of labels on X axis
- [Chartjs]-Show point values in Radar Chart using chart.js
0👍
You have to first check value for null then assign NaN to it.
I solved my issue when i was working on chart.js polar area.
if(value==null)
{
value=NaN;
}
Source:stackexchange.com