forgot to mention I am getting this error. Uncaught SyntaxError: Unexpected token ;
I tried a few different loops to get the data to display, but only get errors. On Monday, March 25, 2019 at 10:58:51 AM UTC-4, Tammi wrote: > > I am trying to get a returned JSON array to display in a google table > chart. Can someone help me with this. So far no luck. > > Here is a sample of the json that is returned. That is what is echo'd out > to browser. > > > [{ > "ts": 1552903183141, > "sk": "testing123", > "val": 0, > "qual": 0, > "tg": "hb" > }, { > "ts": 1552903173141, > "sk": "testing123", > "val": 0, > "qual": 0, > "tg": "hb" > }, { > "ts": 1552903163141, > "sk": "testing123", > "val": 0, > "qual": 0, > "tg": "hb" > }, { > "ts": 1552903153141, > "sk": "testing123", > "val": 0, > "qual": 0, > "tg": "hb" > }, { > "ts": 1552903143141, > "sk": "testing123", > "val": 0, > "qual": 0, > "tg": "hb" > }, { > "ts": 1552903133141, > "sk": "testing123", > "val": 0, > "qual": 0, > "tg": "hb" > }, { > "ts": 1552903123141, > "sk": "testing123", > "val": 0, > "qual": 0, > "tg": "hb" > }, { > "ts": 1552903113141, > "sk": "testing123", > "val": 0, > "qual": 0, > "tg": "hb" > }, { > "ts": 1552903103141, > "sk": "testing123", > "val": 0, > "qual": 0, > "tg": "hb" > }] > > > > this is the graph. > > > > <html> > <head> > <script type="text/javascript" src=" > https://www.gstatic.com/charts/loader.js"></script> > <script type="text/javascript"> > google.charts.load('current', {'packages':['table']}); > google.charts.setOnLoadCallback(drawTable); > function drawTable() { > var data = google.visualization.arrayToDataTable([ > data.addColumn('string', 'sk'); > data.addColumn('string', 'ts'); > data.addColumn('string', 'val'); > data.addColumn('string', 'qual'); > data.addColumn('string', 'tg'); > data.addRow([ > > ['<?php > for ($i = 0; $i < count($json); $i++) { > echo $json[$i]['sk']; > echo $json[$i]['ts']; > echo $json[$i]['val']; > echo $json[$i]['qual']; > echo $json[$i]['tg']; > } > ?>'] > > ]); > > var table = new > google.visualization.Table(document.getElementById('table_div')); > > table.draw(data, {showRowNumber: true, width: '50%', height: > '50%'}); > } > </script> > </head> > <body> > </br> > <div id="table_div"></div> > </body> > </html> > > > thanks for any help > -- 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 google-visualization-api+unsubscr...@googlegroups.com. To post to this group, send email to google-visualization-api@googlegroups.com. Visit this group at https://groups.google.com/group/google-visualization-api. To view this discussion on the web visit https://groups.google.com/d/msgid/google-visualization-api/b9a7a16c-02d3-41ed-9804-d13d37989938%40googlegroups.com. For more options, visit https://groups.google.com/d/optout.