0👍
You can achieve what you’re looking for by writing a callback function that checks if the value
is a weekend day
new Date(Date.parse(value)).getDay() == 1 || new Date(Date.parse(value)).getDay() == 2
If it is we just don’t return it. Otherwise we return the value without changes.
This is how your config should look like:
x:{
type: 'timeseries'
time:{
unit:'day',
},
ticks:{
callback: function(value){
//if weekend dont return the tick label
if(new Date(Date.parse(value)).getDay() == 1 || new Date(Date.parse(value)).getDay() == 2 )
return
return value
}
}
}
- Chartjs-Dynamically set data on Angular-chart.js
- Chartjs-Chartjs Stacked bar graph with forEach for labels
Source:stackexchange.com