The "dataRenderer" plot options allows you to specify a data preprocessor for your plot. This enables jqPlot to accept data in any arbitrary format (e.g. AJAX data soruces, JSON strings, etc.). Below are some examples illustrating how to use dataRenderers.

In this simple example, we create a dataRenderer which takes an array of x values and returns an array of [x, sin(x)] value pairs. Data renderers are passes the plot data and a reference to the plot as arguments.


An example of how to use a dataRenderer to fetch data from a server via an AJAX callback. Here the "data" passed into the plot is actually the url of the data source.


This example uses a more complicated dataRenderer that has been encapsulated as a jqplot plugin and loaded separately. This plugin accepts JSON data objects or strings formatted according to the City Index data format and returns jqPlot formatted data. This example uses a JSON encoded string.


This example uses the same City Index data format, but passes in a JSON object instead of a string.


There is a third argument passed to the data renderer, dataRendererOptions. It was not used in these examples, but can be set as a separate option on the plot to pass additional arguments into the renderer if needed.