简体   繁体   English

JQuery Flot:清晰的图形

[英]JQuery Flot: clear graph

Is there a recommended way to clear a jQuery Flot graph?有没有推荐的方法来清除 jQuery Flot 图? I couldn't find anything the in the API reference.我在 API 参考中找不到任何内容。

By "clear" do you mean "nuke the entire graph," or just clear the data? “清除”是指“清除整个图表”,还是只是清除数据?

To nuke the entire graph: $('#canvas_id').empty();取消整个图形: $('#canvas_id').empty();

To clear the data, just call the usual $.plot(placeholder, data, options);要清除数据,只需调用通常的$.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.只清除图形使用 Matt Ball ansver。

声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM