Reputation: 23
//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
$(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 }
}
]);
});
Upvotes: 0
Views: 32
Reputation: 2004
You need to put the data
in an array as the second parameter of $.plot
, and your options aren't quite correctly formatted. 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
Upvotes: 1