@aarushi,
Looking at your query, most probably the issue is not related to CanvasJS but to JavaScript itself. Please refer to this stackoverflow thread for related info which might help you fix the issue.
If you are still facing issue, kindly create JSFiddle reproducing the issue you are facing and share it with us so that we can look into the code / chart-options being used, understand the scenario better and help you out.
—
Vishwas R
Team CanvasJS