I have the code that should draw a chart, and another php script is sending it the json string. For some reason the Date object is not created, Am I using the wrong json string?
This is the code:
<script>
var jsonData = $.ajax({
url: "get_stat_data.php?ID=2811&CMD=watts",
dataType:"json",
async: false
}).responseText;
</script>
<script type="text/javascript">
google.load('visualization', '1', {packages: ['annotatedtimeline']});
function drawVisualization() {
var data = new google.visualization.DataTable(jsonData);
var annotatedtimeline = new google.visualization.AnnotatedTimeLine(
document.getElementById('visualization'));
annotatedtimeline.draw(data, {'displayAnnotations': true});
}
google.setOnLoadCallback(drawVisualization);
</script>
The json string:
{ "cols": [{"id":"0","label":"Time","type":"date"},{"id":"1","label":"Watts","type":"number"}], "rows":[{"c":[{"v":"new Date( 2013, 12, 14, 19, 53, 31, 0 )"},{"v":"109"}]},{"c":[{"v":"new Date( 2013, 12, 14, 19, 53, 31, 0 )"},{"v":"107"}]},{"c":[{"v":"new Date( 2013, 12, 14, 19, 53, 32, 0 )"},{"v":"109"}]}]}
Thank you!