[英]Unable to plot graph using flot
//I'm trying to plot multiple graph in the same chart using flotchart ,m using the categories plugin,but it doesn't work for the below data //我正在尝试使用flotchart在同一图表中绘制多个图形,使用类别插件在m中绘制图形,但是对于以下数据不起作用
$(function() {
var data = [ ["January", 10], ["February", 8], ["March", 4], ["April", 13], ["May", 17], ["June", 9] ];
$.plot($("#placeholder"), [
{
data: data,
lines: { show: true, fill: true }
},
{
data: data,
bars: { show: true, fill: true }
}
]);
});
You need to put the data
in an array as the second parameter of $.plot
, and your options aren't quite correctly formatted. 您需要将
data
作为$.plot
的第二个参数放入数组中,并且您的选项格式不正确。 Try this: 尝试这个:
$.plot("#placeholder", [ data ], {
series: {
lines: {
show: true,
fill: true
},
bars: {
show: true,
fill: true
}
},
xaxis: {
mode: "categories"
}
});
Here is a working example: 这是一个工作示例:
http://plnkr.co/edit/3SMVMZ1ZcCD8b9DZ3T51?p=preview http://plnkr.co/edit/3SMVMZ1ZcCD8b9DZ3T51?p=preview
声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.