for some reason is not working for me ... it works fine without adding the 
new column (showing only the capacidadmw data without the new 
disponibilidadmw) but when i add the disponibilidadmw that column gets back 
empty, even though it appears in the column titles, but its value comesback 
as 0 in all... but when i try the same query in phpmyadmin it returns 
values properly fot that column too

this is what i have after adding the new info to the data table:
************************************************************************************************************
testing-double-axis.php



************************************************************************************************************
On Thursday, March 7, 2013 1:58:37 PM UTC-6, asgallant wrote:
>
> You also need to add it to the list of columns:
>
> $sth = mysql_query("SELECT planta, capacidadMW, disponibilidadmw FROM 
> planta");
>
> $table = array();
> $table['cols'] = array(
>     array('label' => 'planta', 'type' => 'string'),
>     array('label' => 'capacidad en MW', 'type' => 'number'),
>     array('label' => 'disponibilidad en MW', 'type' => 'number')
> );
>
> $rows = array();
> while($r = mysql_fetch_assoc($sth)) {
>     $temp = array();
>     $temp[] = array('v' => (string)$r['planta']);
>     $temp[] = array('v' => (int) $r['capacidadMW']);
>     $temp[] = array('v' => (int) $r['disponibilidadmw']);
>     $rows[] = array('c' => $temp);
> }
>
> On Thursday, March 7, 2013 2:41:42 PM UTC-5, Ian Haylock wrote:
>
> so is possible.. great !!! : this is what i have: 
>
> ************************************************************************************
> $sth = mysql_query("SELECT planta, capacidadMW FROM planta");
> $rows = array();
> $flag = true;
>
> $table = array();
> $table['cols'] = array(
>
>     array('label' => 'planta', 'type' => 'string'),
>     array('label' => 'capacidad en MW', 'type' => 'number')
> );
>
> $rows = array();
> while($r = mysql_fetch_assoc($sth)) {
>     $temp = array();
>     $temp[] = array('v' => (string)$r['planta']); 
>     $temp[] = array('v' => (int) $r['capacidadMW']); 
>     $rows[] = array('c' => $temp);
> }
>
> $table['rows'] = $rows;
>
> $jsonTable = json_encode($table);
>
> echo $jsonTable;
> ?>
>
> ************************************************************************************
>
> i changed: $sth = mysql_query("SELECT planta, capacidadMW FROM planta"); 
> ...and now i retrieved one more data  (disponibilidadmw) so it looks like 
> this now:
>
> $sth = mysql_query("SELECT planta, capacidadMW, disponibilidadmw FROM 
> planta"); 
>
> my question is... wehere to i add that to my data table??? is it as easy 
> as to add the line: $temp[] = array('v' => (int) $r['disponibilidadMW']);  
> ?? cause is not working for me...
>
> sorry to trouble you for something im sure is basic for you ... and thanks 
> again man.. 
>
>
> On Thursday, March 7, 2013 10:35:15 AM UTC-6, Ian Haylock wrote:
>
> Hi asgallant... i was wondering if you could help me, i have the grapgh 
> working fine showing one bar per x axis data, what i need now is to use a 
> bar chart to show two or more bars per each  x axis data, not stacked but 
> side by side like when you group, see (
> https://developers.google.com/chart/interactive/docs/gallery/barchart?hl=es) 
> ... can i do it following this same example? if so , how do i retrieve 
> and add the other data to the code?
>
>
> On Wednesday, December 12, 2012 3:51:13 PM UTC-6, Ian Haylock wrote:
>
> it worked !!!!!!! cant say thank you enough..... i wish there were more 
> people like you. 
>
> On Wednesday, December 12, 2012 3:39:22 PM UTC-6, asgallant wrote:
>
> You have a couple of unnecessary lines in your javascript:
>
> alert(typeof(jsonData));
> console.log(jsonData);
>
> The first is what pops up that message.  The second is dumping the 
> contents of the json to the developers console - this will cause the script 
> to bomb in older versions of IE, as they don't have a console object. 
>  Delete or comment these two lines and you should be fine.
>
> On Wednesday, December 12, 2012 4:24:30 PM UTC-5, Ian Haylock wrote:
>
>
> <https://lh4.googleusercontent.com/-sbGpcUatdqI/UMj1-PVHiqI/AAAAAAAAALM/1muCotW-3_0/s1600/string.png>
> json generated:
>
> {"cols":[{"label":"planta","type":"string"},{"label":"capacidad en 
> MW","type":"number"}],"rows":[{"c":[{"v":"Francisco 
> Morazan"},{"v":300}]},{"c":[{"v":"Lufussa 
> III"},{"v":267.4}]},{"c":[{"v":"Enersa"},{"v":259}]},{"c":[{"v":"EEHSA - 
> Mesoamerica"},{"v":102}]},{"c":[{"v":"Elcosa"},{"v":80}]},{"c":[{"v":"Lufussa 
> II"},{"v":80}]},{"c":[{"v":"Rio Lindo"},{"v":80}]},{"c":[{"v":"Emce 
> Choloma"},{"v":55}]},{"c":[{"v":"Lufussa I"},{"v":40}]},{"c":[{"v":"Enersa 
> (excedente de 30 
> MW)"},{"v":30}]},{"c":[{"v":"Nacaome"},{"v":30}]},{"c":[{"v":"Ca\u00f1averal"},{"v":29}]},{"c":[{"v":"La
>  
> Ceiba"},{"v":26}]},{"c":[{"v":"La Grecia - 
> Celsur"},{"v":25.5}]},{"c":[{"v":"Cahsa - Azucarera 
> Hondure\u00f1a"},{"v":25}]},{"c":[{"v":"El 
> Nispero"},{"v":22.5}]},{"c":[{"v":"Envasa"},{"v":21}]},{"c":[{"v":"Elcatex"},{"v":21}]},{"c":[{"v":"Chumbagua"},{"v":20}]},{"c":[{"v":"Nacional
>  
> de Ingenieros"},{"v":20}]},{"c":[{"v":"La Puerta MEX - 
> Hitachi"},{"v":18}]},{"c":[{"v":"Celsur"},{"v":18}]},{"c":[{"v":"La Puerta 
> ENEE- General Electric"},{"v":15}]},{"c":[{"v":"CISA - La 
> Esperanza"},{"v":12.7}]},{"c":[{"v":"Cuyamapa"},{"v":12.2}]},{"c":[{"v":"Ampac
>  
> (American Pacific)"},{"v":10.1}]},{"c":[{"v":"Azunosa ( IHSA 
> )"},{"v":10}]},{"c":[{"v":"Geen Valley - Park 
> Dale"},{"v":10}]},{"c":[{"v":"AYSA"},{"v":8}]},{"c":[{"v":"Cuyamel"},{"v":8}]},{"c":[{"v":"Tres
>  
> Valles"},{"v":7.8}]},{"c":[{"v":"El 
> Cisne"},{"v":7}]},{"c":[{"v":"Cortecito"},{"v":6}]},{"c":[{"v":"La 
> Gloria"},{"v":5.3}]},{"c":[{"v":"Santa Fe"},{"v":5}]},{"c":[{"v":"Rio 
> Blanco"},{"v":5}]},{"c":[{"v":"Coronado"},{"v":4.5}]},{"c":[{"v":"Babilonia"},{"v":4.3}]},{"c":[{"v":"San
>  
> Carlos"},{"v":4}]},{"c":[{"v":"Cececapa"},{"v":3.5}]},{"c":[{"v":"El 
> Coyolar"},{"v":1.7}]},{"c":[{"v":"Mangungo 
> I"},{"v":1.5}]},{"c":[{"v":"Santa Maria del 
> Real"},{"v":1.2}]},{"c":[{"v":"Eda"},{"v":1.2}]},{"c":[{"v":"Aceydesa"},{"v":1.1}]},{"c":[{"v":"Yodeco"},{"v":1}]},{"c":[{"v":"Zacapa"},{"v":0.8}]},{"c":[{"v":"Yojoa"},{"v":0.6}]},{"c":[{"v":"Aguan"},{"v":0.5}]},{"c":[{"v":"Lean"},{"v":0.5}]},{"c":[{"v":"La
>  
> Nieve"},{"v":0.5}]}]} 
>
> javascript: 
>
> <html>
>   <head>
>    <meta charset="utf-8">
>     <script type="text/javascript" src="https://www.google.com/jsapi
> "></script>
>      <script type="text/javascript" src="
> http://ajax.googleapis.com/ajax/libs/jquery/1/jquery.min.js";></script>
>     <script type="text/javascript">
>       google.load("visualization", "1", {packages:["corechart"]});
>       google.setOnLoadCallback(drawChart);
>      
>       function drawChart() {
>            var jsonData =$.ajax({
>           url: "plantas_capacidad_chart_info.php",
>           dataType:"json",
>           async: false
>           }).responseText;
>
>           alert(typeof(jsonData)); 
>           console.log(jsonData); 
>              
>         var data = new 
> google.visualization.DataTable(JSON.parse(jsonData));
>         var options = {'title':'Capacidad Instalada de Plantas',
>                        'width':800,
>                        'height':600,
>                        'hAxis.showTextEvery':2,
>                        'backgroundColor': '',
>                        'bar.groupWidth' : '90%'
>                        };
>
>         var chart = new 
> google.visualization.ColumnChart(document.getElementById('chart_div'));
>         chart.draw(data,options);
>       }
>     </script>
>   </head>
>   <body>
>     <div id="chart_div" ></div>
>   </body>
> </html>
>
>
>
>
> image  
>
> ...

-- 
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?hl=en.
For more options, visit https://groups.google.com/groups/opt_out.


Reply via email to