1
I fixed this by disabling the autoSkip feature. Something I had tried previously but could not get to work. Presumably, because I put it in the wrong location.
xAxes:
[{
ticks:
{
callback: function(dataLabel, index) {
//Hide the label of the datasets except the beginning of the week. Display the week, not the day. Return null to hide the grid line, or '' to keep it.
console.log("dataLabel = " + dataLabel + " (dataLabel - 1) % 7 " + (dataLabel - 1) % 7)
return (dataLabel - 1) % 7 === 0 ? (Math.floor((dataLabel - 1) / 7)).toString() : null;
},
fontSize: 16,
autoSkip: false,
},
scaleLabel: {
display: true,
labelString: 'Week'
}
}]
- Chartjs-How to set Solid label in bar chart using Chart JS
- Chartjs-How do I prevent Chartjs tooltip callback returning multiple instances of the same value?
Source:stackexchange.com