akash
akash

Reputation: 173

Highcharts- show all the days of the particular month

I have fiddle here fiddle

What I want is to display all the days of jan 2012 on X-axis. i.e 1.jan,2.jan, and so on.I dont want interwal between two days. this is x-axis code.

 xAxis: {
            type: 'datetime',
            min: Date.UTC(2012, 0, 1),
            max: Date.UTC(2012, 0, 31),
            labels: {
            step: 1,
                    style: {
                            fontSize: '13px',
                            fontFamily: 'Arial,sans-serif'
                            }
                    },
                    dateTimeLabelFormats: { // don't display the dummy year
                        month: '%b \'%y',
                        year: '%Y'
                    }
                },

Upvotes: 0

Views: 1176

Answers (1)

wergeld
wergeld

Reputation: 14462

This can be done with the xAxis.tickInterval property. As it says right in the docs that to get an interval of 1 day you would do:

xAxis: {
  type: 'datetime',
  min: Date.UTC(2012, 0, 1),
  max: Date.UTC(2012, 0, 31),
  tickInterval: 24 * 3600 * 1000, // 1 day
  labels: {
    step: 1,
    style: {
      fontSize: '13px',
      fontFamily: 'Arial,sans-serif'
    }
  },

As you can see it causes an overlap of your xAxis labels. You would then have to find the correct xAxis.labels formatting that suits your needs.

Upvotes: 2

Related Questions