开发者

JQuery Flot: clear graph

开发者 https://www.devze.com 2022-12-08 02:58 出处:网络
Is there a recommended way to clear a jQuery Flot graph? I couldn\'t find any开发者_JS百科thing the in the API reference.By \"clear\" do you mean \"nuke the entire graph,\" or just clear the data?

Is there a recommended way to clear a jQuery Flot graph? I couldn't find any开发者_JS百科thing the in the API reference.


By "clear" do you mean "nuke the entire graph," or just clear the data?

To nuke the entire graph: $('#canvas_id').empty();

To clear the data, just call the usual $.plot(placeholder, data, options); where data is empty.


in my case just clearing container won't help, some flot bindings stil working.

var plot = $.plot(placeholder, data, options);
// some other code
//to completely remove flot chart call
plot.destroy(); // remove graph and all bindings

to clear only graph use Matt Ball ansver.

0

精彩评论

暂无评论...
验证码 换一张
取 消