@Priya,
Please take a look at this tutorial for fetching data from database. You can even download different samples from here for integrating with different languages.
For making your chart dynamic, you need to fetch your data from database iteratively. You can also check this jsFiddle for reference.
—-
Bivek Singh,
Team CanvasJS