Code
$table = array();
$table['cols'] = array(
array('label' => 'Date', 'type' => 'date'),
array('label' => 'Orders', 'type' => 'number')
);
$rows = array();
while($row = oci_fetch_assoc($stid)) {
$temp = array();
$temp[] = array('h' => (int) $row['Date']);
$temp[] = array('v' => (int) $row['Orders']);
$rows[] = array('c' => $temp);
}
$table['rows'] = $rows;
$jsonTable = json_encode($table);
Update
Thanks to WereWolf - The Alpha for the answer, it is using the complete date but now I have some weird problem with \ and / as below.
{
"cols":[
{
"label":"Date",
"type":"date"
},
{
"label":"Orders",
"type":"number"
}
],
"rows":[
{
"c":[
{
"h":"2014\/05\/02 00:00"
},
{
"v":8
}
]
},
{
"c":[
{
"h":"2014\/05\/06 00:00"
},
{
"v":10
}
]
},
{
"c":[
{
"h":"2014\/05\/07 00:00"
},
{
"v":9
}
]
},
{
"c":[
{
"h":"2014\/05\/08 00:00"
},
{
"v":10
}
]
}
]
}