Home Forums Chart Support Chart Graph not showing dates Reply To: Chart Graph not showing dates

#41370

Giant,

Since you are using PHP date, you will have to convert the date to a JavaScript timestamp. To convert PHP date to JavaScript timestamp, first, you need to convert PHP date to PHP timestamp using strtotime and then convert PHP timestamp to JavaScript timestamp by multiplying PHP timestamp by 1000. Also, you will have to convert the y-values to numerical format using (int) since y property only accepts numbers.

Kindly refer to the code-snippet below for the changes that will have to be made to your code,

array_push($dataPoints1, array("x" => strtotime(date($resultRows['exp_dt'])) * 1000, "y" => (int) $resultRows['iamt']));
array_push($dataPoints2, array("x" => strtotime(date($resultRows['exp_dt'])) * 1000, "y" => (int) $resultRows['eamt']));


Adithya Menon
Team CanvasJS