You must be logged in to post your query.
Home › Forums › Chart Support › Date pass throw php
i want to pass date in array but it not pass correctly please help me I used this one
array_push($dataPoints_1, array(“x”=> ‘new Date(‘.$year.’, ‘.$month, “y”=> $order_total));
@umeshkrishna,
In order to convert PHP date to Charts (JavaScript timestamp), 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 as shown below,
$phpDate = date("Y-m-d h:i:sa"); $phpTimestamp = strtotime($phpDate); $javaScriptTimestamp = $phpTimestamp * 1000;
You also need to set xValueType property to ‘dateTime’ as x-value will be a timestamp.
__ Adithya Menon Team CanvasJS
You must be logged in to reply to this topic. Login/Register