hzp
hzp

Reputation: 3

How to set the fixed xAxis value in Highcharts

I need to set the fixed xAxis value like that picture , like that picture I tried to set this, but it can't :

tickPositioner: function(min, max) {
            var result = []
            let today = moment().subtract(4,`day`).format("YYYY-MM-DD")
            let tomorrow = moment().subtract(3,`day`).format("YYYY-MM-DD")
            result.push(moment(`${today} 06:00:00`).unix()*1000)
            result.push(moment(`${today} 12:00:00`).unix()*1000)
            result.push(moment(`${today} 18:00:00`).unix()*1000)
            result.push(moment(`${tomorrow} 00:00:00`).unix()*1000)
            result.push(moment(`${tomorrow} 06:00:00`).unix()*1000)
            result.info = this.tickPositions.info;
            return result;
          }

I don't know how to set these values ?

Upvotes: 0

Views: 44

Answers (1)

Core972
Core972

Reputation: 4114

You need to use the xAxis.tickInterval API documentation like this :

xAxis: {
  tickInterval: 21600000
}

Fiddle

Upvotes: 1

Related Questions