Reputation: 479
How remove month everywhere except at the first day of the month and leave the numbers days? Month must be written only one, first day each month.
Now my code
xAxis: {
type: 'datetime',
labels: {
overflow: 'justify'
}
},
Example https://jsfiddle.net/o5926erd/5/
Upvotes: 0
Views: 120
Reputation: 5222
You can use labels.formatter function of your xAxis: http://api.highcharts.com/highcharts/xAxis.labels.formatter
formatter: function() {
var xAxis = this.axis,
previousMonth,
date,
newTicks = [],
index,
returnedString,
months = this.chart.options.lang.months;
Highcharts.each(xAxis.tickPositions, function(t) {
date = new Date(t);
if (date.getMonth() !== previousMonth) {
previousMonth = date.getMonth();
newTicks.push(t);
}
});
index = newTicks.indexOf(this.value);
date = new Date(this.value);
returnedString = index >= 0 ? date.getDate() + '. ' + months[date.getMonth()] : date.getDate()
return returnedString;
}
Here you can see an example how it can work: https://jsfiddle.net/o5926erd/8/
Upvotes: 1