I have a bar chart, which is autoSkipping every second xAxes labels. I need to show all labels, however setting AutoSkip: False is having no effect. Below is my code, I have removed some extra datasets from it.
var myChart2 = new Chart(document.getElementById("ch2"), {
type: 'bar',
data: {
datasets: [
{
label: 'Budget',
data: [<data here>]
}
]
},
options: {
tooltips: {
callbacks: {
label: function (tooltipItem, data) {
return '$' + tooltipItem.yLabel;
}
}
},
scales: {
yAxes: [{
ticks: {
beginAtZero: true,
callback: function (value, index, values) {
return '$' + (value >= 1000000 ? value/1000000+'M' : value);
}
},
stacked: true
}],
xAxes: [{
type: "time",
ticks: {
autoSkip: false // Not working
},
time: {
unit: 'month',
format: 'DD MMM YYYY',
tooltipFormat: 'MMM YYYY',
displayFormats: {
month: 'MMM'
}
},
offset: true,
gridLines: {
display: false,
offsetGridLines: true
}
}]
}
}
});
In my case, I needed to set source: date
. You will get all the date steps on xAxi. By the way, try source: auto
it'll try set optimal count of steps (not all). Check here https://www.chartjs.org/docs/latest/axes/cartesian/time.html#ticks-source
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With