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

收到错误 TypeError: d is undefined

请帮忙!!

使用ajax调用数据

4

1 回答 1

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/

于 2013-05-10T14:17:49.833 回答