I have a Javascript Highchart that I’m displaying and trying to get more information out of. I have it set up currently so when I click a column in the bar graph, it alerts me to the name of the column and the value.
I’m trying to go a step further by rendering the contents of that column of the graph in a table below. I have the HTML all done but I’m trying to pass in the value clicked, this.category which contains a string, into the @show_me instance variable that will render the chart as soon as it’s not nil.
My code below is breaking my graph, causing it not to render. I’m not entirely sure of the correct way to pass in the value of this.category into @show_me on click.
Any help would be huge. Thanks so much!
click: function() { this.category == <%= @show_me %>; }
Not exactly sure what you’re trying to do, but it appears like you just need to change this
to this
Although you should be aware that anything with the
<%= %>tags is prerendered before the page is loaded.Update:
Looks like what you’re trying to do might involve some AJAX. You might consider looking through this tutorial since this is a semi-complicated topic, and can be confusing if you have no experience with it.