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 Query

More Query from same tag