Reputation: 7782
How do I completely destroy a graph and then redraw one from scratch. The reason I need this is because I want to have the option of changing the graph type from let's say a bar graph to a line graph.
I don't think you can do that strait up, so instead I try to destroy the graph completely and just make a new one.
plot.destroy();
$.jqplot("graph_id", [data], options);
The destroying went fine, but the reinit did not work at all. Any ideas?
Upvotes: 4
Views: 7849
Reputation: 21
Do like the following,
var inti = new Array();
inti.push([0, 0, 0]);
var plot2 = $.jqplot('graph_id', inti, null);
plot2.destroy();
plot2 =$.jqplot("graph_id", [data], options);
this will redraw ur jqplot..
Upvotes: 2
Reputation: 7782
It was my own error, the jqplot worked just fine actually.
Upvotes: 1