Bill Software Engineer
Bill Software Engineer

Reputation: 7782

jqplot completely redraw a graph

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

Answers (2)

Raghu
Raghu

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

Bill Software Engineer
Bill Software Engineer

Reputation: 7782

It was my own error, the jqplot worked just fine actually.

Upvotes: 1

Related Questions