Highcharts ; x-axis scaling issue

2019-06-01 17:34发布

问题:

I have following lines of code of highchart:

xAxis : {
  "categories" : [100, 200, 250, 300, 400]
}

The categories are not equi-distant. But highchart API draws the points with equal distance. This gives wrong interpretation to the user. I want points to be drawn with such distances, which will give user correct information. The distance shown between two points should be proportionate to the actual distance between two points.

回答1:

mentioning them in categories itself makes them equidistant.

if you want to have them graded accordingly then you need change the data array

if for now your data is categories: [100, 200, 250, 300, 400] data: [10, 45, 64, 34 ,91] change them like this data: [[100,10], [200,45], [250,64], [300,34] ,[400,91]] this will work only when the x axis has values(integers) not text.

don't mention any categories

Hope this will help you