source: consulta_publica/consulta/templates/consulta.base.pie.graphic.html @ 4d11fe2

baseconstituyenteestudiantesgeneralplan_patriasala
Last change on this file since 4d11fe2 was 7310249, checked in by rudmanmrrod <rudman22@…>, 7 años ago

Solventadas consultas en generales en la consulta y procesamiento, agregados graficos de barra y torta para las respuestas simple/multiple/si-no de la consulta, Agregado modelos de estado, municipio y parroquia de Argenis

  • Propiedad mode establecida a 100644
File size: 1.3 KB
Línea 
1<div id="{{name}}_{{counter}}"></div>
2<script>
3    $(document).ready(function () {
4        var opciones = {{item.opciones|safe}};
5        var valores = {{item.valores}};
6        var total = 0;
7        var datos = []
8        $.each(valores,function(key,value){
9            total+=value;
10        });
11        $.each(opciones,function(key){
12            datos.push({'name':opciones[key],'y':valores[key]/total})
13        });
14   
15        // Build the chart
16        Highcharts.chart('{{name}}_{{counter}}', {
17            chart: {
18                plotBackgroundColor: null,
19                plotBorderWidth: null,
20                plotShadow: false,
21                type: 'pie'
22            },
23            title: {
24                text: '{{item.titulo}}'
25            },
26            tooltip: {
27                pointFormat: '{series.name}: <b>{point.percentage:.1f}%</b>'
28            },
29            plotOptions: {
30                pie: {
31                    allowPointSelect: true,
32                    cursor: 'pointer',
33                    dataLabels: {
34                        enabled: false
35                    },
36                    showInLegend: true
37                }
38            },
39            series: [{
40                name: 'Porcentaje',
41                colorByPoint: true,
42                data: datos
43            }]
44        });
45});
46</script>
Nota: Vea TracBrowser para ayuda de uso del navegador del repositorio.