JSON data formatted according the the City Index API spec can be read in directly by jqPlot thorugh the use of the dataRenderer option and a custom ciParser data renderer. The ciParser data renderer will translate either a JSON encoded string or JSON object.
To use the the ciParser, include the jqplot.json2.js
and jqplot.ciParser.js
files. Specify the $.jqplot.ciParser
as the renderer in the plot's "dataRenderer" option. The City Index JSON data can then be passed into the jqplot function as shown in the examples below:
Here, a stringified JSON data objects is passed into the jqplot function.
This example uses the same City Index data format, but passes in a JSON object instead of a string.