krishna mohan
krishna mohan

Reputation: 111

tick interval is not working while applying tick interval its showing x and y both values

i want to show each day date , but im getting alternative dates ,like 1 feb and 3 feb and 5 feb i need full date like below without missing any dates n y axis.tried tickinterval 1 but its showing x and y values both.

1-feb-2020

2-feb-2020

graph

                        xAxis: {
                        tick,
                        type:'datetime',
                        dataLabels: {
                            align: 'right',
                            rotation: 45,
                            shape: null
                        }

                    },

Upvotes: 0

Views: 253

Answers (2)

Sebastian Wędzel
Sebastian Wędzel

Reputation: 11633

Setting the xAxis to the under config is a solution which you are looking for:

  xAxis: {
    type: 'datetime',
    tickInterval: 24 * 3600 * 1000,
    dateTimeLabelFormats: {
      day: '%e-%b-%Y'
    }
  },

Demo: https://jsfiddle.net/BlackLabel/qmro0was/

API: https://api.highcharts.com/highcharts/xAxis.dateTimeLabelFormats

API: https://api.highcharts.com/highcharts/xAxis.tickInterval

Upvotes: 1

ppotaczek
ppotaczek

Reputation: 39099

You need to set tickInterval to one day and use the formatter function:

xAxis: {
  ...,
  tickInterval: 1000 * 60 * 60 * 24,
  labels: {
    formatter: function(){
      return Highcharts.dateFormat('%e-%b-%Y', this.value);
    }
  }
}

Live demo: http://jsfiddle.net/BlackLabel/6m4e8x0y/4815/

API Reference:

https://api.highcharts.com/highcharts/xAxis.tickInterval

https://api.highcharts.com/highcharts/xAxis.labels.formatter

Upvotes: 1

Related Questions