How to clear previous data in chart using canvas at html 5?

i am using single bar chart for different data sets in my program and also use separate functions for each data sets.
every time i call the function the data will be overlapped the previous data in that bar chart element.
how to rectify this issue? and how to clear previous data in canvas?
please kindly help someone for this issue.