Simplest way to clear a container using raphaeljs javascript graphical library
with the latest gRaphael 0.5.1, I clear the chart easily with just calling the clear() method. i.e.
var r = Raphael(...)
r.clear();
But I'm not sure if it would work for your version
Actually it's just come to my notice that there's the much easier paper.clear(); It's not documented.
When you create a paper it creates a DOM object. You can access this with
paper.canvas
When you create a new Raphael object, you create a new DOM object and leave the original one alone! This is the best way to do it considering everything though. If you want to delete the canvas you only need to do the next command:
//Note: after calling this function the paper object will be useless!
//Make paper object null (or a new paper object) immediately!
function clearPaper(paper){
var paperDom = paper.canvas;
paperDom.parentNode.removeChild(paperDom);
}