I use the High Charts library with rails using the gem found here . Everything works very beautifully, except when I try to add a storyline to any axis, I canβt figure it out. Here are two options I've tried so far, and their results. Any understanding of what was going on would be greatly appreciated.
Option 1:
chart.yAxis([{title: 'Y-Axis', min: 0, plotLines: {value: 25}])
Result: I get an error in JavaScript
Uncaught TypeError: Object
In particular, this refers to the following code in the highcharts.js file
each((options.plotLines || []).concat(options.plotBands || []), function (plotLineOptions) {
When I pause execution, the options.plotLines variable is an object, not an array, so it is not a concat method.
Option 2:
chart.yAxis([{title: '', min: 0, plotLines: [{value: 25}]}])
Result: The page cannot display with the following error message from Rails.
You must pass a Hash to Highcharts::Axis::PlotLines. You passed [{:value=>25}]
I'm not sure what to do with this, given the API documentation for high graphics. I expected this to work, as I would like to give more than 1 plotLine.
I also tried using chart.renderer.path, but that also failed. Can someone explain what is happening and hopefully suggest a way that I can draw a horizontal line on the High Charts chart in Rails with this stone.
thanks