i have a json array in the following format which i get in a ajax response
{"graph":[{"date_display":"2013-12-26","ticketss_sold_on_date":"3","money_earned":"468"}]}
the google api javascript part which draw tha graph takes the data in the following way
var sales = google.visualization.arrayToDataTable([
['Day', 'Sales', ],
['Mon', 1000],
['Tue', 1170],
['Wed', 660],
['Thu', 1030],
['Fri', 2056],
['Sat', 1654],
['Sun', 969]
]);
pleae tell me how to pass my json array data to the above google.api code in the following format to
var sales = google.visualization.arrayToDataTable([
['DATE', 'Sales', ],
['date from json array ', number of tickets sold from json array],
like
[2013-12-12, 15]
[2013-12-11, 10]
[2013-12-10, 18]
and so on....
]);
i am getting data by applying foreach method in jquery area in the follwoing way
<script>
$.each(response.graph,function(i,el)
{
alert(el.date_display+' - '+el.ticketss_sold_on_date+' - '+el.money_earned);
});
</script>
but when i apply this each method in in above graph api, it gives me error..
How to pass my above json response array to google api to draw areachart.?