Turns out I have a graph that works for me well in a single page, but
when I call with AJAX shows the graphic, but if you check with Firebug
I see that shows the full information of the graph (html).

This is the code of the graph

<html>
  <head>
  <?php
include_once('cone.php');
$link=conectarse();

$sql = mysql_query("select * from exitpoll",$link) or
die(mysql_error());
$array=mysql_fetch_array($sql);

$capriles = $array['capriles'];
$diego = $array['diego'];
$maria = $array['maria'];
$medina = $array['medina'];
$pablo = $array['pablo'];

  ?>
    <!--Load the AJAX API-->
    <script type="text/javascript" src="https://www.google.com/
jsapi"></script>
    <script type="text/javascript">

      // Load the Visualization API and the piechart package.
      google.load('visualization', '1.0', {'packages':['corechart']});

      // Set a callback to run when the Google Visualization API is
loaded.
      google.setOnLoadCallback(drawChart);

      // Callback that creates and populates a data table,
      // instantiates the pie chart, passes in the data and
      // draws it.
      function drawChart() {

        // Create the data table.
        var data = new google.visualization.DataTable();
        data.addColumn('string', 'Topping');
        data.addColumn('number', 'Slices');
        data.addRows([
          ['Capriles Radonsky', <?php echo $capriles; ?>],
          ['Diego Arria', <?php echo $diego; ?>],
          ['Maria C. Machado', <?php echo $maria; ?>],
          ['Pablo Medina', <?php echo $medina; ?>],
          ['Pablo Perez', <?php echo $pablo; ?>]
        ]);

        // Set chart options
        var options = {'title':'Grafico de Exit Poll',

                titleTextStyle: {color: '#5c5c5c',fontSize: 25},
               titlePosition: 'out' , legend : 'rigth',
pieSliceTextStyle: {color: 'black',fontSize: 18},

                           colors: ['yellow', '#b2c8b2', 'gray', 
'#cdded1','blue'],
                       'width':600,
                       'height':300, is3D: true};

        // Instantiate and draw our chart, passing in some options.
        var chart = new
google.visualization.PieChart(document.getElementById('chart_div'));
        chart.draw(data, options);
      }
    </script>
  </head>

  <body>
    <!--Div that will hold the pie chart-->
    <div id="chart_div"></div>
  </body>
</html>


this is the AJAX code

function objetoAjax(){
        var xmlhttp=false;
        try {
                xmlhttp = new ActiveXObject("Msxml2.XMLHTTP");
        } catch (e) {
                try {
                   xmlhttp = new ActiveXObject("Microsoft.XMLHTTP");
                } catch (E) {
                        xmlhttp = false;
                }
        }

        if (!xmlhttp && typeof XMLHttpRequest!='undefined') {
                xmlhttp = new XMLHttpRequest();
        }
        return xmlhttp;
}


function
guardar_exitpoll(centro,capriles,diego,maria,medina,pablo,total){

        divResultado = document.getElementById('exitpoll');
                //instanciamos el objetoAjax
                ajax=objetoAjax();
                ajax.open("GET", "funciones.php?poll_centro="+centro
+"&poll_capriles="+capriles+"&poll_diego="+diego+"&poll_maria="+maria
+"&poll_medina="+medina+"&poll_pablo="+pablo+"&poll_total="+total);

                ajax.onreadystatechange=function() {

        if (ajax.readyState==1 || ajax.readyState==2 || ajax.readyState==3) {
                //mostrar resultados en esta capa
                divResultado.innerHTML = "<label class='label'>GUARDANDO 
INFORMACION
DEL CENTRO "+centro+"</label>";
                divResultado.style.display="block";
                }
        if (ajax.readyState==4) {
                //mostrar resultados en esta capa
                divResultado.innerHTML = ajax.responseText;
                divResultado.style.display="block";
                }

                }
                ajax.send(null);

                divResultado1 = document.getElementById('grafico_poll');
                //instanciamos el objetoAjax
                ajax1=objetoAjax();
                ajax1.open("GET", "funciones.php?
grafico_exitpoll=si&poll_centro="+centro);

                ajax1.onreadystatechange=function() {

        if (ajax1.readyState==4) {
                //mostrar resultados en esta capa
                divResultado1.innerHTML = ajax1.responseText;
                divResultado1.style.display="block";
                }

                }
                ajax1.send(null);

}


home page where you call the ajax

<div id="grafico_poll" align="center">

        <div align="center">
        <?php include_once('grafico_poll.php'); ?>
        </div>

</div>

-- 
You received this message because you are subscribed to the Google Groups 
"Google Visualization API" group.
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