Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

Highcharts - show every other x-axis category

I have Highcharts set up to display a graph with a bunch of xAxis categories. This is all working fine, but I would like to be able to skip some of the xAxis categories, so not everything one is shown. You can see an example of this working within Campaign Monitor's reporting section (screenshot: http://screencast.com/t/Y2FjNzQ4Y).

Any idea how I can achieve this same layout?

like image 225
Ian McIntyre Silber Avatar asked Sep 15 '10 02:09

Ian McIntyre Silber


2 Answers

    xAxis: {
        categories: categoriesname,
        labels: {
            style: {
                color: '#000',
                font: '9px Trebuchet MS, Verdana, sans-serif'
            }
        },
        **tickInterval: TickInterval,**// SET THIS
        tickPixelInterval: 80,
        tickmarkPlacement: 'on'
    },
like image 42
valis Avatar answered Sep 21 '22 15:09

valis


It seems like the xAxis:labels:step value is what should be used to accomplish this:

        xAxis: {
            categories: ['JAN', 'FEB', 'MAR', 'APR', 'MAY'],
            labels:{
                step: 2 // this will show every second label
            }
        },

Step Axis Labels

Super late, but I figure this can help someone out.

like image 154
d2burke Avatar answered Sep 17 '22 15:09

d2burke