I’m using Highcharts within my Backbone application to display some information in a column graph.
I use the datalabels in the chart to allow the user to click on and move to the detail page of that datapoint. This is not a normal window.location call, but should be a window.location.hash call. This is because I want to move to an anchor, which will be picked up by my Backbone router.
This is what a typical label (using the formatter) is transformed into:
<tspan onclick="location.href="/#/test/1"" style="cursor: pointer; " x="360">Sectie nummer 6</tspan>
So in other words, is it possible to have Highcharts do a onclick=”window.location.hash=…” instead of location.href?
Thanks in advance!
An alternative solution (not the most cross-browser solution because of its dependency on
<text>but you can get it working with the incompatible IE versions)Why
jQuery.on()?jsFiddle Demo