Home Forums Chart Support Date in xValue – Don’t Show. Reply To: Date in xValue – Don’t Show.

#39467

@g3nius,

To pass date as x-value using PHP, you need to first convert PHP date to PHP timestamp using strtotime and then convert PHP timestamp to JavaScript timestamp by multiplying PHP timestamp by 1000. Along with passing the timestamp as x value, you need to set xValueType option to ‘dateTime’ in dataseries.

foreach($result as $row){
  array_push($dataPoints, array("x"=> strtotime($row['created_at']) * 1000, "y"=> $row['responseTime']));
}

—-
Manoj Mohan
Team CanvasJS