score:7

Accepted answer

As we discussed in chat, there were a few missing pieces.

  • You needed a local copy of the Highcharts library
  • You needed to reference your script that calls the library from the correct place.

So, in short, you needed this in your layout:

<script src="//ajax.googleapis.com/ajax/libs/jquery/1.7.1/jquery.min.js" type="text/javascript"></script> 
<script src="/javascripts/js/highcharts.js" type="text/javascript"></script> <!--where you put the high charts library -->
<script src="/highcharts.js" type="text/javascript"></script> <!-- your script -->

Now going forward (assuming you are working w/ rails 3.1+), I'd suggest moving your javascripts to a more conventional location. In 3.1, rails likes to see it in app/assets/javascripts but public/javascripts is still fine, just not exactly conventional.

You will get a lot of milage by understanding the rails helpers to insert script tags and the Asset Pipeline.

Good luck!

score:1

The problem is in the first line of source that is var charts; remove it and you are done.

score:1

There is an issue with the Chart keyword. Please change like

new Highcharts.Chart({ Chart is with small c


Related Query

More Query from same tag