Delete or delete a previously drawn groove diagram
How to remove or delete a previously drawn pit diagram.
I did the following to redraw the chart with new data:
chart.data = newData; chart.draw();
This will redraw if the data is not empty. If the new data is empty, the previous chart remains and is not erased. How do I clear a previously drawn graph?
source to share
If you are trying to delete the entire chart (shapes and axis and everything) you can do:
chart.svg.selectAll('*').remove();
If you're just trying to remove the bars / lines / shapes and leave the axes and legend intact, you can do:
chart.series.forEach(function(series){
series.shapes.remove();
});
I think it might actually be a bug related to this: https://github.com/PMSI-AlignAlytics/dimple/issues/29 to clear the old rows if you set the chart.data parameter to an empty array ...
source to share
Thank. I could get it from series.shapes.remove (), below is the code snippet:
if (0 === total_records) {
chart.series[0].shapes.remove();
chart.draw(2000);
}
else {
chart.series[0].shapes.remove();
chart.series.splice(0, 1);
chart.addSeries("Name", dimple.plot.bar);
chart.data = p_data;
chart.draw(2000);
}
source to share