Fix bug where chart does not clear properly