Hi! Really thanks for your attention. I had changed the line, but still no plot... You can check here: http://ebib.com.br/plotsus/data/index.html
On Wed, Feb 4, 2015 at 1:10 PM, 'Sergey Grabkovsky' via Google Visualization API <[email protected]> wrote: > Hi Raphael, > > You have an extra set of brackets in your dataTable.addRows call. You JSON > data already returns an array of arrays, and putting brackets around it > causes it to be an array of arrays of arrays, which is not the format that > addRows takes. Simply changing your line to "dataTable.addRows(jsonData)" > should fix your issues. > > On Wed Feb 04 2015 at 7:01:33 AM Raphael Saldanha <[email protected]> > wrote: > >> Hi everyone, >> >> I have a php file that returns an array and I'm trying to use those data >> to create a Google Chart Calendar visualization. >> >> The php file is here: http://ebib.com.br/plotsus/data/dados.php >> >> And below is my html code. If I just paste the results from PHP inside >> dataTable.addRows([ ... ]); >> >> everything goes ok, but not happens when I use the code below. Please >> help! >> >> <html> >> <head> >> <script language="javascript" type="text/javascript" >> src=" >> http://ajax.googleapis.com/ajax/libs/jquery/1.7.0/jquery.min.js"> >> </script> >> <script type="text/javascript" src="https://www.google.com/jsapi" >> ></script> >> <script type="text/javascript"> >> google.load("visualization", "1.1", {packages:["calendar"]}); >> google.setOnLoadCallback(drawChart); >> >> function drawChart() { >> var jsonData = $.ajax({ >> url: "dados.php", >> dataType: "json", >> async: false >> }).responseText; >> >> >> var dataTable = new google.visualization.DataTable(); >> dataTable.addColumn({ type: 'date', id: 'Date' }); >> dataTable.addColumn({ type: 'number', id: 'Won/Loss' }); >> >> dataTable.addRows([ jsonData ]); >> >> >> >> var chart = new google.visualization.Calendar(document. >> getElementById('calendar_basic')); >> >> var options = { >> title: "Red Sox Attendance", >> height: 350, >> }; >> >> chart.draw(dataTable, options); >> } >> </script> >> </head> >> <body> >> <div id="calendar_basic" style="width: 1000px; height: 350px;"></div> >> </body> >> </html> >> >> >> -- >> You received this message because you are subscribed to the Google Groups >> "Google Visualization API" group. >> To unsubscribe from this group and stop receiving emails from it, send an >> email to [email protected]. >> To post to this group, send email to >> [email protected]. >> Visit this group at >> http://groups.google.com/group/google-visualization-api. >> For more options, visit https://groups.google.com/d/optout. >> > -- > You received this message because you are subscribed to a topic in the > Google Groups "Google Visualization API" group. > To unsubscribe from this topic, visit > https://groups.google.com/d/topic/google-visualization-api/goOPKt0-hYw/unsubscribe > . > To unsubscribe from this group and all its topics, send an email to > [email protected]. > To post to this group, send email to > [email protected]. > Visit this group at > http://groups.google.com/group/google-visualization-api. > For more options, visit https://groups.google.com/d/optout. > -- You received this message because you are subscribed to the Google Groups "Google Visualization API" group. To unsubscribe from this group and stop receiving emails from it, send an email to [email protected]. To post to this group, send email to [email protected]. Visit this group at http://groups.google.com/group/google-visualization-api. For more options, visit https://groups.google.com/d/optout.
