简体   繁体   中英

Highcharts x-axis label

In chart, the x-axis labels are overlapping, when chart data is big. I have used "step" property as follows :

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

I calculate the value of stepVal, depending upon data. This resolves the issue of overlapping labels on x-axis. But, when I zoom the chart, I want to see all the labels on x-axis. How to get it?

In Highcharts 3.0 you can use

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

You would need to change the xAxis labels steps in the event of a zoom action. 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.

The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.

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