mansj
Posts: 5
Joined: Thu Feb 04, 2010 8:41 am

Axis label intervals

Hello,

I am trying to use Highcharts to display rather large datasets - in my case a column chart with over 90 values in a rather small-ish area. The chart looks OK, but the X-axis labels are all garbled since all the values are on top of each other. Is there a way to limit the number of axis labels printed out? I can't find it.

I'm attaching an image from my test to show you what I'm talking about.

Thank you!
Attachments
Skärmavbild 2010-02-04 kl. 09.43.26.png
Skärmavbild 2010-02-04 kl. 09.43.26.png (31.98 KiB) Viewed 3720 times
torstein.honsi
Site Admin
Posts: 9215
Joined: Thu Nov 09, 2006 11:22 am
Location: Vik i Sogn, Norway

Re: Axis label intervals

Try removing the categories array from the xAxis config. Then the axis should be treated like a linear axis, and ticks be spread out according to tickInterval or tickPixelInterval. It might not work in the current version though, so you coud try http://highcharts.com/js/prerelease/hig ... 1.2.src.js.
Torstein Hønsi
CTO, Founder
Highsoft
mansj
Posts: 5
Joined: Thu Feb 04, 2010 8:41 am

Re: Axis label intervals

admin wrote:Try removing the categories array from the xAxis config. Then the axis should be treated like a linear axis, and ticks be spread out according to tickInterval or tickPixelInterval. It might not work in the current version though, so you coud try http://highcharts.com/js/prerelease/hig ... 1.2.src.js.
Thanks, but does this mean I can not have any x-axis labels at all? This will be highly confusing I'm afraid...
torstein.honsi
Site Admin
Posts: 9215
Joined: Thu Nov 09, 2006 11:22 am
Location: Vik i Sogn, Norway

Re: Axis label intervals

There will be labels, but they will be numeric by default. You can always rotate your categories like http://dev.highcharts.com/demo/?example ... me=default, but with 90 labels it will be pretty tight.

Also, remember you can format your labels with options.xAxis.labels.formatter, so you can for example return the point's name option.
Torstein Hønsi
CTO, Founder
Highsoft
Huu
Posts: 5
Joined: Fri Feb 12, 2010 7:13 pm

Re: Axis label intervals

If you go to the line in the sourcecode that says "if (categories || min == max) tickInterval = 1;" and change it to "if (min == max) tickInterval = 1;", that should tell the program to use auto tickInterval. If that doesn't work, then you can also change the 1 into 'auto'.

Return to “Highcharts Usage”