最新消息:雨落星辰是一个专注网站SEO优化、网站SEO诊断、搜索引擎研究、网络营销推广、网站策划运营及站长类的自媒体原创博客

javascript - Highcharts series graph to start and end on tick and end on max - Stack Overflow

programmeradmin2浏览0评论

I want a highcharts graph, to start and end on tick, and have the final x limit equal to the max value.

Even though my configuration has:

    max: 11,
    endOnTick: true

I found that the actual final value of the graph is 12. How do I make it to be 11 without having to change endOnTick to false?

Example:

/

Thanks in advance.

I want a highcharts graph, to start and end on tick, and have the final x limit equal to the max value.

Even though my configuration has:

    max: 11,
    endOnTick: true

I found that the actual final value of the graph is 12. How do I make it to be 11 without having to change endOnTick to false?

Example:

http://jsfiddle/5VVMm/

Thanks in advance.

Share asked Nov 8, 2013 at 8:02 maranomarano 7426 silver badges9 bronze badges 1
  • In case you want to start from 0 and and on 11, what should be between? Between 0 and 11 there is no 'nice labels'. If you don't like solution provided by Highcharts, see that answer. I think that first options suits you the best. – Paweł Fus Commented Nov 8, 2013 at 9:48
Add a ment  | 

1 Answer 1

Reset to default 4

Easiest way is to use predefined tickInterval, following will do:

xAxis: {
    min: 0,
    step: 2,
    max: 11,
    startOnTick: true,
    endOnTick: true,
    tickInterval: 1
}

A little bit trickier is tickPixelInterval usage, in your case 50 will do.

Things bee even more plicated, if your chart is scalable/zoomable. You'll have to write custom event handler to update those properties, to ensure that your tickInterval is diveder to your data range (if it's even possible, i.e. data range is integer, not float) to ensure that your last tick equals max axis value.

发布评论

评论列表(0)

  1. 暂无评论