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  ----string: 
>
> On Wednesday, December 12, 2012 2:30:17 PM UTC-6, asgallant wrote:
>>
>> I've never seen any " (string) " message.  Can you post a screenshot, 
>> your javascript code, and a sample of the json returned by your query?
>>
>> On Wednesday, December 12, 2012 12:55:49 PM UTC-5, Ian Haylock wrote:
>>>
>>> query solved !!!!!!!! thank you. 
>>> now my only problem is that before the browsers shows the graphs i keep 
>>> getting the  " (string) " message and have to click on it to see the graph 
>>> ... any ideas ??? i have changed the types, added options, etc and still 
>>> nothing
>>>
>>> On Wednesday, December 12, 2012 11:38:06 AM UTC-6, asgallant wrote:
>>>>
>>>> This isn't causing your problem, but since your "capacidadMW" is a 
>>>> decimal type, and not an integer, you should probably change (int) 
>>>> $r['capacidadMW']); to (float) $r['capacidadMW']);
>>>>
>>>> That aside, I don't see anything in your code that would truncate the 
>>>> results.  Try running this and see what number is displayed:
>>>>
>>>> <?php
>>>>
>>>> include('connect-db.php');
>>>>
>>>> $sth = mysql_query("SELECT planta, capacidadMW FROM planta");
>>>> echo mysql_num_rows($sth);
>>>> ?>
>>>>
>>>> If that shows 55 records, then there is a problem in the PHP; if it 
>>>> shows less than 55, then there is a problem with your connection to the 
>>>> database.
>>>>
>>>> On Wednesday, December 12, 2012 12:17:24 PM UTC-5, Ian Haylock wrote:
>>>>>
>>>>> just to let u know, the "planta" record in my table is type 
>>>>> Varchar(45) and the "capacidadMW" is type decimal (9,2)
>>>>>
>>>>> On Wednesday, December 12, 2012 11:03:40 AM UTC-6, Ian Haylock wrote:
>>>>>>
>>>>>> thanks for the reply .. 
>>>>>>
>>>>>> the query im using in phpmyadmin showing 55 records: SELECT planta, 
>>>>>> capacidadMW FROM planta;
>>>>>>
>>>>>> the code using to encode using JSon (result is only 14 records):
>>>>>>
>>>>>> <?php
>>>>>>
>>>>>> include('connect-db.php');
>>>>>>
>>>>>> $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;
>>>>>> ?>
>>>>>>
>>>>>>
>>>>>> On Wednesday, December 12, 2012 10:55:45 AM UTC-6, asgallant wrote:
>>>>>>>
>>>>>>> At a guess, I would say you have an error in the SQL in PHP.  If you 
>>>>>>> post your PHP code, I'll take a look at it.
>>>>>>>
>>>>>>> On Wednesday, December 12, 2012 11:41:25 AM UTC-5, Ian Haylock wrote:
>>>>>>>>
>>>>>>>> Hi asgallant, thank you very much for th taking the time to help 
>>>>>>>> others. i have a question if you dont mind, i followed Diana´s sample 
>>>>>>>> and 
>>>>>>>> got it to work, well sort of, i used my onw db and managed to show the 
>>>>>>>> graph and everithing, the only thing is that my mysql query running in 
>>>>>>>> phpmyadmin shows 55 records and my json result shows only 14 records, 
>>>>>>>> how 
>>>>>>>> is that possible ??? 
>>>>>>>>
>>>>>>>> On Wednesday, December 12, 2012 12:54:06 AM UTC-6, Chrystopher 
>>>>>>>> Medina wrote:
>>>>>>>>>
>>>>>>>>>
>>>>>>>>> ok im gonna start with the php information. and u know i have 
>>>>>>>>> another problem how i cant charge two pie charts in the same place 
>>>>>>>>> but each 
>>>>>>>>> with different results.... u know i have two questions and i want to 
>>>>>>>>> charge 
>>>>>>>>> the results from them. in two  pie charts..... because i read that 
>>>>>>>>> just one 
>>>>>>>>> pie chart can be charged in the same place.... i could be mistaken 
>>>>>>>>
>>>>>>>>

-- 
You received this message because you are subscribed to the Google Groups 
"Google Visualization API" group.
To view this discussion on the web visit 
https://groups.google.com/d/msg/google-visualization-api/-/vjBuA3ea0VQJ.
To post to this group, send email to [email protected].
To unsubscribe from this group, send email to 
[email protected].
For more options, visit this group at 
http://groups.google.com/group/google-visualization-api?hl=en.

Reply via email to