Brandon, There is no reason I know of for a Table chart to fail to display a single row of data. Here is a simple example showing that it can be done using your data: https://jsfiddle.net/dlaliberte/qv66nq92/2/
To figure out what you are seeing, we can't do much with your PHP code except make guesses about what might be happening. It would be better if you could look in your browser's javascript debugger and copy the script code that is generated on your server side. You might see the problem just by doing that. Also note if there are any javascript errors displayed in the console. On Mon, Jul 6, 2015 at 5:38 AM, Brandon Matthews <[email protected] > wrote: > I have an unusual dilemma, and I think the crux of my problem stems from > having only a single table row of data. I've exhausted every possibility I > can think of, and then some. Why only a single row of data? Well I want the > data in the row to be uniform with the google charts and tables already in > place. The particular row I'm trying to add, will showcase current market > data, as opposed to the delayed data I produce already. I wanted to add a > single column table across the top or down the sidebar to highlight things > like "price', volume, up $, down$, etcetera. > > Now I can get the data, and I can convert it to JSON, and when I echo the > json data, I instantly get the JSON formatted results I sought.... > > Yet as soon as I attempt to put the google chart code in my header, my > site goes into a tailspin. The page will no longer load, and inevitably > results in a completely white screen...not even the page around the div > being called, is shown....remove the chart /table codes, and the page loads > instantly...I should add i have something to the tune of 40 charts and > tables that do not do this, and the code is basically copy/paste at this > point. The only difference that I can see, is that the table I want has > only one data row. > > > > $rtsql="SELECT `symbol`,`name`,`change`,`change_pct`,`lasttrade`,`volume`, > `bid`, `ask`,`52wkhi`,`52wklw` FROM `realtimedata` WHERE `symbol` = > '$query'"; > $res= mysql_query($rtsql); > $table = array(); > $table['cols'] = array( > array('label' => 'Symbol', 'type' => 'string'), > array('label' => 'Name', 'type' => 'string'), > array('label' => 'Change', 'type' => 'number'), > array('label' => 'Change Pct', 'type' => 'number'), > array('label' => 'Last Trade', 'type' => 'number'), > array('label' => 'Volume', 'type' => 'number'), > array('label' => 'Bid', 'type' => 'number'), > array('label' => 'Ask', 'type' => 'number'), > array('label' => '52 Wk High', 'type' => 'number'), > array('label' => '52 wk Low', 'type' => 'number') > ); > $table['rows'] =array(); > while($rT=mysql_fetch_assoc($resdataRT)) { > $temp = array(); > $temp[] = array('v' => $rT['symbol']); > $temp[] = array('v' => $rT['name']); > $temp[] = array('v' => (float) $rT['change']); > $temp[] = array('v' => (float) $rT['change_pct']); > $temp[] = array('v' => (float)$rT['lasttrade']); > $temp[] = array('v' => $rT['volume']); > $temp[] = array('v' => (float)$rT['bid']); > $temp[] = array('v' => (float)$rT['ask']); > $temp[] = array('v' => (float)$rT['52wkhi']); > $temp[] = array('v' => (float)$rT['52wklw']); > $rows[] = array('c' => $temp); > }; > $table['rows'] = $rows; > $rtddata = json_encode($table); > echo $rtddata; > > Here are the results to be 'tabled' > > {"cols":[{"label":"Symbol","type":"string"},{"label":"Name","type":"string"},{"label":"Change","type":"number"},{"label":"Change > Pct","type":"number"},{"label":"Last > Trade","type":"number"},{"label":"Volume","type":"number"},{"label":"Bid","type":"number"},{"label":"Ask","type":"number"},{"label":"52 > Wk High","type":"number"},{"label":"52 wk > Low","type":"number"}],"rows":[{"c":[{"v":"GOOG"},{"v":"Google > Inc"},{"v":1.56},{"v":0.3},{"v":523.4},{"v":"1235913"},{"v":513.33},{"v":522},{"v":598.01},{"v":486.23}]}]} > > > <script type="text/javascript"> > if (window.location.pathname == "/rtdata/") { <?php > if(is_page('rtdata')) { include("script.php");}?> > google.load('visualization', '1', {packages: ['table']}); > google.setOnLoadCallback(drawTable); > function drawTable() { > var data = new google.visualization.DataTable(<?=$rtddata?>); > var table= new > google.visualization.Table(document.getElementById('table_div')); > table.draw(data); > } > } > > of course div is on page.....it should simply produce a single line of > dataq with a header...yet it simply crashes the entire system .. > > If I'm missing the obvious, I'd love to hear it because I am out of > answers..Has anyone ever tried making a single row table? > > (also tried doing a single column, multi row version with same result as > well as breaking the table into two separate tables in case a container > size problem existed, and got the same result...even changed page names, > removed the if location clauses, and deleted it all and started again, all > to no avail) > > > -- > 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. > -- Daniel LaLiberte <https://plus.google.com/100631381223468223275?prsrc=2> - 978-394-1058 [email protected] <[email protected]> 5CC, Cambridge MA [email protected] <[email protected]> 9 Juniper Ridge Road, Acton MA -- 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.
