JQuery Flot: clear graph

deostroll picture deostroll · Oct 7, 2009 · Viewed 11.8k times · Source

Is there a recommended way to clear a jQuery Flot graph? I couldn't find anything the in the API reference.

Answer

Matt Ball picture Matt Ball · Oct 7, 2009

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.