@ravindu-dilhara,
The sample shared above seems to be working fine. If you are still facing issue, can you kindly share the sample reproducing the issue over Google-Drive or Onedrive so that we can look into your code, run it locally at our end to understand the scenario better and help you out?
https://imgur.com/a/5tQ4YHD
—-
Manoj Mohan
Team CanvasJS