Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

How do I create a correctly scaled x-axis?

I'm using HighCharts line plots where my x-axis data is unevenly distributed:

[4, 10, 40, 100, 400, 1000, etc.]

Currently the x-values are placed evenly. I want the distance between x[5] and x[4] to be 10 times that between x[3] and x2. How do I do this?


In the GoogleCharts lingo, I need a continuous axis.


In the docs, I only see "linear", "logarithmic", and "datetime" for the axis type. ("linear" is the default and does not do what I want).

like image 622
Matt Fenwick Avatar asked Mar 22 '12 20:03

Matt Fenwick


1 Answers

Since you didn't post your javascript generating the charts I'll have to guess, but I assume you are using categories within your xAxis. The categories are evenly distributed, so don't use them in this case.

If you change your series data block to specify x and y values (http://www.highcharts.com/ref/#series--data example 2) the xAxis will show correct proportions for your values. For example look at this fiddle.

like image 160
dgw Avatar answered Sep 28 '22 06:09

dgw