本文介绍了在Highcharts中只有xAxis类型xAxis的3个步骤的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

有没有办法在xAxis上只有三个步骤,一个在开始,一个在中间,一个在最后。我已经玩过 xAxis.labels.steps 但我无法获得可靠的结果。



注意xAxis类型是 datetime

解决方案

至少有三种方法(自动):
$ b $ ol

  • 使用 tickPositioner (最好的恕我直言):你有完全的权限决定应该在哪里设置标记(例如: [min,average,max] )。


  • 使用 tickPixelInterval :仅当您有固定的图表宽度以及时间间隔为ncie数字的倍数时才有用(如0 - 1 - 2或100 - 200 - 300)

  • 使用 tickInterval :仅当您知道时才有用xAxis范围,例如0-10,因此您可以设置 tickInterval:5


    和jsfFiddle比较:


    Is there a way to get only three steps on the xAxis, one at start, one in the middle and one in the end. I've played around with xAxis.labels.steps but I couldn't get an reliable result.

    Note the xAxis type is datetime.

    解决方案

    There is at least three ways to achieve that (which are automatically):

    1. Use tickPositioner (the best IMHO): you have full access to decide where tick should be set (for example: [min, average, max]).

    2. Use tickPixelInterval: useful only when you have fixed width of the chart, and when interval will be multiple of ncie numbers (like 0 - 1 - 2, or 100 - 200 - 300)

    3. Use tickInterval: useful only when you know range of xAxis, for example 0-10, so you can set tickInterval: 5

    And jsfFiddle with compare: http://jsfiddle.net/FQ68Y/3/

    这篇关于在Highcharts中只有xAxis类型xAxis的3个步骤的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持!

    09-17 23:15