1
votes

Highcharts does a great job figuring out appropriate tick intervals.

However, I have a "duration" series (in ms), which I format e.g. like "3y 6M" or "1d 3h" or "3h 30min" for display. Because Highcharts is optimizing the tick intervals for the ms value (e.g. 10,000,000ms), I end up with awkward values such as [ 2h 46min 40s, 5h 33min 20s, 8h 20min ] rather than [ 3h, 6h, 9h ].

Can I get Highcharts to prefer multiples of certain values (e.g. 1000, 60 * 1000, 60 * 60 * 1000 etc)? I'd rather not have to calculate the exact tick interval myself (depends on chart size etc).

unformated y-axis valuesformatted y-axis values

2
Are you using type: datetime?Sualkcin
There's no datetime involved, just a string category label, and an integer duration value (milliseconds).ejain
and you're saying that you don't want to calibrate tickInterval? I'm unclear as to how you DO want the interval to be; just rounded off or something?Sualkcin
Yes, instead of setting a tickInterval (ugly as I'd need to analyze the data and handle resizing etc), I'd rather override the code that is used to calculate the tick intervals--if Highcharts lets me do that.ejain
You can dynamically create your own variable to use for the tickInterval value. i.e. tickInverval: $myCalculatedValue. other than that, you might want to try a datetime axis which allows you to set a pointInvterval such as 1 day or 1 hour, etc.Sualkcin

2 Answers

1
votes

I think you should consider using datetime axis for yAxis. For example: http://jsfiddle.net/jRGvs/

    yAxis: {
        type: 'datetime'
    },

    series: [{
        type: 'column',
        name: 'Column',
        data: [Date.UTC(1970, 0, 1, 2, 30), 
               Date.UTC(1970, 0, 1, 1, 45), 
               Date.UTC(1970, 0, 1, 4, 10), 
               Date.UTC(1970, 0, 1, 3, 30)]
    }]
0
votes

you can go with label > formatter for yAxis,

here you can write a routine which will handle the text/value to be displayed beside the grid line. but the thing is you cannot override the tick interval from here.