Home forums Using CanvasJS Display Datetime from php in x axis of canvasjs chart Reply To: Display Datetime from php in x axis of canvasjs chart

#27784

@bharadhan,

Please take a look at this Gallery Page for an example on rendering chart with data retrieved from database in PHP. You can also download PHP Samples form our download page to run sample locally.

I am retrieving datetime from mysql database. I want to convert it to date in php and display it in x-axis of the canvasjs chart

Converting date-time to timestamp in PHP and multiplying it by 1000 to convert it to timestamp in JavaScript before passing it to chart-options should work fine in your case.

If you are still facing issue, kindly share sample project along with sample database over Google Drive or Onedrive so that we can look into the code, understand the scenario better and help you out.


Vishwas R
Team CanvasJS