当前位置: 动力学知识库 > 问答 > 编程问答 >

javascript - High Charts : Equal spacing for X Axis for unequal interval

问题描述:

I have a scatter graph on highchart. I read values from json. Now my x-axis Values vary from 190645 to 208686 with uneven interval these are called run numbers. Now what i want is that even though the interval between points of x axis is not equal yet they should be plotted with equal spacing in between them. I want the graph to be symmetric and not have unequal gaps between them.

Is there a way to achieve this ?

Another solution possible is that I also have a value in the JSON that ranges from 1-526 (number of points to be plotted). If i use this as x axis then the points have equal spacing. But I want to display the value of run number (the uneven interval) in tool tip and x-axis label. Is it possible to have separat values for label and tool tip then the one being plotted ?

Either of the two solution will do for me

网友答案:

You could force highcharts to use equal spacing between the x-axis values by treating them as categories.

$('#container').highcharts({
    xAxis: {
        categories: ['100', '200', '250', '300', '320', '350',
            '500', '1000', '1100', '1250', '1500', '1600']
    },
...

See http://jsfiddle.net/p0kmbag3/1/ for an example.

分享给朋友:
您可能感兴趣的文章:
随机阅读: