codigo del grafico
grafico_poll.php
Código HTML:
Ver original
<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"> // 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--> </body> </html>
parte del codigo de la pagina donde se muestra
Código HTML:
Ver original
parte del ajax
Código Javascript:
Ver original
divResultado3 = document.getElementById('exitpoll'); //instanciamos el objetoAjax ajax3=objetoAjax(); ajax3.open("GET", "funciones.php?mesa_centro="+centro+"&exitpoll=si"); ajax3.onreadystatechange=function() { if (ajax3.readyState==4) { //mostrar resultados en esta capa divResultado3.innerHTML = ajax3.responseText; divResultado3.style.display="block"; } } ajax3.send(null);
espero que alguien sepa algo al respecto