@sana,
Please take a look at this gallery example to render chart using data from the database in PHP.
In case this doesn’t help please share the server-side technology along with a sample project and sample database reproducing the issue over google drive/one drive so that we can look into it understand your requirements better and help you out with an appropriate solution.
__________
Indranil Deo
Team CanvasJS