source: consulta_publica/consulta/templates/consulta.base.column.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.9 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([opciones[key],(valores[key]/total)*100])
13        });
14        // Build the chart
15        Highcharts.chart('{{name}}_{{counter}}', {
16            chart: {
17                plotBackgroundColor: null,
18                plotBorderWidth: null,
19                plotShadow: false,
20                type: 'column'
21            },
22            title: {
23                text: '{{item.titulo}}'
24            },
25            tooltip: {
26                pointFormat: '{series.name}: <b>{point.y:.1f}%</b>'
27            },
28            xAxis: {
29                type: 'category',
30                labels: {
31                    rotation: -45,
32                    style: {
33                        fontSize: '13px',
34                        fontFamily: 'Verdana, sans-serif'
35                    }
36                }
37            },
38            yAxis: {
39                min: 0,
40                title: {
41                    text: 'Porcentaje'
42                }
43            },
44            legend: {
45                enabled: false
46            },
47            series: [{
48                name: 'Porcentaje',
49                colorByPoint: true,
50                data: datos,
51                dataLabels: {
52                    enabled: true,
53                    rotation: -90,
54                    color: '#FFFFFF',
55                    align: 'right',
56                    format: '{point.y:.1f}', // one decimal
57                    y: 10, // 10 pixels down from the top
58                    style: {
59                        fontSize: '13px',
60                        fontFamily: 'Verdana, sans-serif'
61                    }
62                }
63            }],
64
65        });
66});
67</script>
Nota: Vea TracBrowser para ayuda de uso del navegador del repositorio.