I'm trying to generate a chart in my Rails 3 project using the canvasXpress HTML5 / JavaScript library. Their charting API uses JSON as one of the parameters in their constructor. For example:
new CanvasXpress('canvas', /* JSON here */);
In Rails I'll have a view which renders the chart as part of it's overall output. So, the JavaScript to create the chart will live in the view.
I'm not quite sure how to have Rails generate the JSON the JavaScript needs. Should the JSON be generated in a partial view?
In any case, an example would be nice.