score:0

Accepted answer

I fixed it by this changes:

tickPositioner: function () {
  let positions = [],        
      tick = Math.floor(this.dataMin),
      increment = Math.ceil((this.dataMax - this.dataMin) / 10)

  if (this.dataMax === 0) {
    positions = [0]
  } else if (this.dataMax !== null && this.dataMin !== null) {
      for (tick; tick  <= this.dataMax; tick += increment) {
        positions.push(tick)
      }
  }
  return positions
}

score:1

Notice that for one point all your variables (tick, increment, dataMax) are equal 0, so as a consequence this for is an infinity loop.

You can check it here: https://jsfiddle.net/BlackLabel/35suo8k0/

As a solution you can use this code:

  xAxis: {
    tickPositioner() {
      let positions = [],
        tick = Math.floor(this.dataMin),
        increment = Math.ceil((this.dataMax - this.dataMin) / 10)

      if (this.dataMax && this.dataMin) {
        for (tick; tick <= this.dataMax; tick += increment) {
          positions.push(tick)
        }
      }
      return positions
    }
  },

I changed the if condition - now it checks if the dataMax and dataMin exist.

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


Related Articles