
// 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', 'Candidatura');
    data.addColumn('number', 'Porcentaje de votos');
    for ( var c in resultados ) {
        data.addRow([c, parseFloat(resultados[c]['Total'])]);
    }
    
    // Set chart options
    var options = {'title':'Resultados elecciones rectorado',
                   'width':'95%',
                   'is3D' : true,
                   'fontSize' : 24,
                   'height':400,
                   'legend': {'position':'bottom'}};
    
    // Instantiate and draw our chart, passing in some options.
    var chart = new google.visualization.PieChart(document.getElementById('total'));
    chart.draw(data, options);
    
    // Create the data table.
    var sectores = new google.visualization.DataTable();
    sectores.addColumn('string', 'Sector - %');
    var columnas = new Object;
    for ( var c in resultados ) {
	sectores.addColumn('number', '% '+c);
	sectores.addColumn({type:'number',role:'annotation'});
	for ( var s in resultados[c]['Sector'] ) {
	    columnas[resultados[c]['Sector'][s]["Sector"]] = [];
        }
    }
    for ( var c in resultados ) {
        for ( var s in resultados[c]['Sector'] ) {
	    columnas[resultados[c]['Sector'][s]["Sector"]].push(parseFloat(resultados[c]['Sector'][s]['Resultado']));
	    columnas[resultados[c]['Sector'][s]["Sector"]].push(parseFloat(resultados[c]['Sector'][s]['Votos']));
	}
    }

    for (var c in columnas ) {
	var breve = c.replace('PROFESORADO','Pr');
	breve = breve.replace('DOCTOR','Dr');
	breve = breve.replace('PERMANENTE','Perm.');
	breve = breve.replace('ASOCIADOS','Asoc.');
	sectores.addRow([breve,columnas[c][0],columnas[c][1],columnas[c][2],columnas[c][3]]);
    }
	
    // Set chart options
    options = {'title':'Resultados elecciones rectorado - Sectores',
               'width':'95%',
               'height':500,
	       'vAxis' : {'maxTextLines': 5},
	       'hAxis' : {'maxTextLines': 5},
	       animation:{
		   duration: 500,
		   easing: 'out',
	       },
               'legend': {'position':'bottom'} };
    
    // Instantiate and draw our chart, passing in some options.
    var chart_sectores = new google.visualization.BarChart(document.getElementById('sectores'));
    chart_sectores.draw(sectores, options);
}

window.onresize = drawChart;

@@ -2251,178 +2251,59 @@
 s',%0A
-               'width':'95%25',%0A               'height':500,%0A%09       'vAxis' : %7B'maxTextLines': 5%7D,%0A%09       'hAxis' : %7B'maxTextLines': 5%7D,%0A%09       animation:%7B%0A
+%09       animation: %7B%22startup%22: true,%0A%09
 %09%09  
- 
+%22
 duration
 : 50
@@ -2302,44 +2302,97 @@
 tion
+%22
 : 
-5
+10
 00,%0A%09%09
- 
+%09
   
+%22
 easing
+%22
 : 'out'
+%7D
 ,%0A
-%09       %7D
+               'width':'95%25',%0A               'height':500
 ,%0A  

Añade animación