-
Notifications
You must be signed in to change notification settings - Fork 0
Pie Charts
plowdawg edited this page Jun 14, 2012
·
4 revisions
JQuery_Cheats gem uses XML parsed by a JavaScript that makes it possible to interact with the jqPlot Javascript. To start off, the JQuery_Cheats gem includes a helper method that can be loaded right into the view where you want your graph.
In order to make a pie chart make sure you need the following code in your asset pipeline:
//=require jqplot/plugins/jqplot.pieRenderer.min.js
To load the chart into the view the code is:
<%= piechart("name","/path/to/xml") %>
replace the name and the path to where you need it.
In your controller, just make sure that you have a format.xml
in your respond_to
block in the action where you want your XML to be loaded.
The graph requires you to make a separate XML file for parsing, which should be the name of the action, so show would require show.xml.erb.
- All bars must be contained within
- The entire XML must have a root of