Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

highcharts tick position incorrect when categories specified

please take a look at this graph which displays as expected (i.e. ticks are at the specified positions):

http://jsfiddle.net/a3ZrC/3/

xAxis: {
    tickPositions: [1, 3, 4, 5, 10],
    gridLineWidth: '1',
    lineWidth: 1
    //tickPosition: 'outside'       
},

Now, if I specify categories, the tick positions (and grid) change, they are no longer on the label, see:

http://jsfiddle.net/a3ZrC/4/

xAxis: {
    tickPositions: [1, 3, 4, 5, 10],
    categories: ['one', 'two', 'three', 'four', 'five', 'six', 'seven', 'eight', 'nine', 'ten', 'eleven', 'twelve'],
    gridLineWidth: '1',
    lineWidth: 1
    //tickPosition: 'outside'       
},

Is this a bug or am I missing something?

Cheers,

Tony.

like image 688
Tony Avatar asked Nov 29 '25 16:11

Tony


1 Answers

Guess you missed a trick here. You can specify the tickmarkPlacement option .

It defaults to between. Specify it as on to get the results as you desired.

xAxis: {            
        tickPositions: [1, 3, 4, 5, 10],
        categories: ['one', 'two', 'three', 'four', 'five', 'six', 'seven', 'eight', 'nine', 'ten', 'eleven', 'twelve'],
        gridLineWidth: '1',
        lineWidth: 1,
        tickmarkPlacement: 'on'
    },

Fiddled version.

Hope this helps.

like image 98
Gopinagh.R Avatar answered Dec 02 '25 07:12

Gopinagh.R



Donate For Us

If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!