蓝天,小湖,湖水中一方小筑

Ajax loading multi series to jqPlot

The Ajax example of jqPlot only shows how to plot on series data, but the request I have met needs multi series. The solution is easy, just record here for later reference.

In the example, The function used to load ajax data is ajaxDataRenderer, which returns array of data. For multi series, just return more than one data array. Here is a sample data set:

[
  [
    [1,1],[2,2],[3,3],[4,4],[5,5]
  ],
  [
    [5,1],[4,2],[3,3],[2,4],[1,5]
  ]
]