PHP - Mostrar actividades dinamicas en un grafico con HighCharts

 
Vista:

Mostrar actividades dinamicas en un grafico con HighCharts

Publicado por carlos (1 intervención) el 27/06/2017 05:04:01
Por favor si alguien me podria ayudar, para poder hacer que una lista de actividades que obtengo de un formulario y recepciono en un array y lo manejo en un foreach para aislar los valores del array, y estas se vuelvan dinámicas o salgan las especificadas, en relación con el monto obtenido de un query de cada actividad para que sea graficada linealmente
----------------------

--DE ESTA FORMA RECEPCIONO LOS DATOS DEL FORMULARIO

1
2
3
4
5
6
7
8
9
if (isset($_POST["gastoCons"])) {
    $variable = $_POST["gastoCons"];
    $stitulo = 'Precio Constante';
}
 
if (isset($_POST["ingresoCorr"])) {
    $variable = $_POST["ingresoCorr"];
    $stitulo = 'Precio Corriente';
}


1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
<script type="text/javascript">
 
 
Highcharts.chart('container', {
 
    title: {
        text: 'Solar Employment Growth by Sector, 2010-2016'
    },
 
    subtitle: {
        text: '<?php echo $stitulo?>'
    },
 
    yAxis: {
        title: {
            text: 'Number of Employees'
        }
    },
    legend: {
        layout: 'vertical',
        align: 'right',
        verticalAlign: 'middle'
    },
 
    plotOptions: {
        series: {
            pointStart: <?php echo $finicio ?>
        }
    },
 
    series: [
    {
 
        <?php
 
        foreach($variable as $posicion=>$actividad)
        {
 
                    $sql="select d.monto
            from det_pbi d, variables v, for_pbi f
            where d.id_variable = v.id_variable and
            f.id_forma = d.id_forma
            and v.d_variable = '$actividad'
            and anio between $finicio and $ffinal
            and d_forma = '$forma'";
 
            $fila = mysql_query($sql,$cn);
 
        ?>
 
        --EL PROBLEMA ES COMO HACER QUE ESTAS ACTIVIDADES SEAN PROCESADAS A LA VEZ QUE LOS MONTOS DEL WHILE DE ABAJO
        name: '<?php echo $actividad ?>',
 
 
 
        data: [
         <?php
 
        while ($r=mysql_fetch_array($fila)) {
 
        ?>
 
       --ESTO ME MUESTRA SIN PROBLEMAS LOS MONTOS DE CADA ACTIVIDAD SELECCIONADA
        [<?php echo $r['monto']?>],
 
 
        <?php
        }
        }
        ?>
 
        ]
    }
 
    ]
 
});
</script>
Valora esta pregunta
Me gusta: Está pregunta es útil y esta claraNo me gusta: Está pregunta no esta clara o no es útil
0
Responder