flon图的Json数据解析错误

时间:2013-05-10 11:07:08

标签: json ajax parsing external flot

datapie = [
{"label": "Running",  "data": [19.5], "color":"#e1ab0b"},
{"label": "Stopped",  "data": [4.5], "color":"#fe0000"},
{"label": "Terminated",  "data": [36.6], "color":'#93b40f"}
];

收到错误     TypeError:d未定义

请帮助!!

使用ajax

调用数据

1 个答案:

答案 0 :(得分:1)

数据看起来格式不正确。它应该是这样的:

datapie = [
{label: "Running",  data: 19.5, color: '#e1ab0b'},
{label: "Stopped",  data: 4.5, color: '#fe0000'},
{label: "Terminated",  data: 36.6, color: '#93b40f'}
];

教程 - http://digitalunion.osu.edu/2011/12/21/make-graphs-and-charts-with-jquery-using-flot-js-%E2%80%94-a-brief-tutorial/

小提琴 - http://jsfiddle.net/Rnusy/5/