Aman Goyal
Aman Goyal

Reputation: 109

show custom date on xAxis in highstock lineseries

I have month end data for each month from february to december. On xAxis i want to show the day alond with month like 29.feb, 31.dec etc. i used tick interval and datetimelabelformats like this :

        xAxis : {
                    type: 'datetime',
                    tickInterval: 3600*1000,//time in milliseconds
                    datetimelabelformats:{
                        day: '%e. %b',
                        month: '%b \'%y',
                        year: '%y'
                    }
                },

its showing date like 21.mar,25.Apr but i a not able to show the month end date like 31.mar. can anyone help? Here is the fiddle

Upvotes: 0

Views: 42

Answers (1)

Rohan Kumar
Rohan Kumar

Reputation: 40639

Getting late, but I think you need to use labels like,

xAxis:{
    labels: {
        formatter: function() {
          return Highcharts.dateFormat('%e. %b', this.value - 
                    3600000 //needed otherwise it will start from 1 date of month
                 );
        }
    },
    ...
}

Fiddle

Upvotes: 1

Related Questions