简体   繁体   English

Highcharts x轴标签

[英]Highcharts x-axis label

In chart, the x-axis labels are overlapping, when chart data is big. 在图表中,当图表数据很大时,x轴标签重叠。 I have used "step" property as follows : 我使用了“step”属性如下:

xAxis: {                
            labels:{
                step: (stepVal ? stepVal : 0),
                },
    }

I calculate the value of stepVal, depending upon data. 我根据数据计算stepVal的值。 This resolves the issue of overlapping labels on x-axis. 这解决了x轴上重叠标签的问题。 But, when I zoom the chart, I want to see all the labels on x-axis. 但是,当我缩放图表时,我希望在x轴上看到所有标签。 How to get it? 怎么弄?

In Highcharts 3.0 you can use 在Highcharts 3.0中,您可以使用

chart.xAxis[0].update({
    labels: {
        step: newValue
    }
}

for updating step. 用于更新步骤。 Just setting new value in options for new chart won't work. 只是在新图表的选项中设置新值不起作用。

I believe what you are looking for is this.. 我相信你要找的是这个......

http://api.highcharts.com/highcharts#chart.events.selection http://api.highcharts.com/highcharts#chart.events.selection

You would need to change the xAxis labels steps in the event of a zoom action. 在进行缩放操作时,您需要更改xAxis标签步骤。 You will need to determine how many labels you would want to show, based on how many labels are visible as a result of the zoom. 您需要根据缩放结果可见的标签数量来确定要显示的标签数量。

声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM