Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

Highstocks - Use tickmarkPlacement "between" on datetime Axis (no categories)

Is there any workaround to have tickMarkPlacement set as "between" on a datetime Axis? I am aware is not supported by the API but I was hoping to find some sort of hack/plugin.

like image 718
ozke Avatar asked Dec 18 '14 10:12

ozke


1 Answers

You can fudge it with the x axis label's x property.

Example:

  • http://jsfiddle.net/jlbriggs/3qtZr/36/

[[update after comments:

if you mean that you want the data points to also line up 'between', then there isn't a good easy way.

My approach would be

1) make sure there is only one data point per axis tick, ideally

2) adjust the x value of the data point to push it to the right in a way that corresponds with the label offset

3) adjust tooltip formatters to correct the date for display

or, 4) just go with categories

However, if you can explain why you want to do this, what effect you're going for, perhaps there's more that can be done.

{{further updates:

After playing around a little more, I found another way to fudge the data point placement, though I am unclear whether you need that.

Example here:

  • http://jsfiddle.net/jlbriggs/3qtZr/39/

It uses the pointPlacement property. The catch is that the pointPlacement property doesn't work if there is not a columns series present with as many data points as the line series, it seems.

So this method adds and hidden dummy column series in order to make the pointPlacement property affect the line series.

Not elegant, but it beats having to adjust the data values and then re-adjust them in the formatter.

like image 71
jlbriggs Avatar answered Oct 13 '22 21:10

jlbriggs