Highcharts - yAxis tickInterval to max data

前端 未结 1 1163
忘了有多久
忘了有多久 2021-01-24 04:03

I am trying to set max value dynamically of the largest number. I am not sure, where I am doing wrong...

Any help please?

Online Demo

1条回答
  •  南方客
    南方客 (楼主)
    2021-01-24 04:35

    It is possible to use tockPositioner and set ticks there like:

        showLastLabel: false,
        tickPositioner: function(min, max) {
          var ticks = [],
            tick = min,
            step = Math.round((max - min) / 7);
    
          while (tick < max - step / 2) {
            ticks.push(Math.round(tick));
            tick += step;
          }
          ticks.push(Math.round(max));
          ticks.push(Math.round(max+step)); //hidden - added for top padding
    
          return ticks;
        }
    

    Example: http://jsfiddle.net/e6har510/

    0 讨论(0)
提交回复
热议问题