In chart.js, Is it possible to hide x-axis label/text of bar chart if accessing from mobile ?
You can extend the current BarChart and remove the xLabels like this.
function registerCustomBarChart() {
Chart.types.Bar.extend({
name: "customBarChart",
initialize: function (data) {
Chart.types.Bar.prototype.initialize.apply(this, arguments);
var xLabels = this.scale.xLabels
xLabels.forEach(function (label, i) {
xLabels[i] = '';
})
}
});
}
var myBarChart = new Chart(context).customBarChart(data);