Flot Chart:以对象格式设置数据图表

时间:2017-03-15 05:22:27

标签: flot

来自文档Data Format

The data is an array of data series:

[ series1, series2, ... ]
A series can either be raw data or an object with properties. The raw data format is an array of points:

[ [x1, y1], [x2, y2], ... ]
E.g.

[ [1, 3], [2, 14.01], [3.5, 3.14] ]

我的数据格式为:

[
   {Date: "03-15-2016", Rank: 50}, 
   {Date: "03-16-2016", Rank: 77},
   {Date: "03-17-2016", Rank: 63},
]

所以它是一个嵌套对象的数组。但是我的图表没有建成。根据doc,系列可以是具有属性的对象。

如何使用具有属性的对象构建折线图?

1 个答案:

答案 0 :(得分:1)

A series can be an object with properties, but the data property of a series object has to be an array of datapoints (which also have to be arrays).