remove chart when moving away from the page