PHP - Graficar datos con mysql php y highchart

 
Vista:
Imágen de perfil de Amilcar

Graficar datos con mysql php y highchart

Publicado por Amilcar (1 intervención) el 17/05/2017 06:21:47
Estimados amigos del foro,
Tengo una consulta que hacerles, estoy intentando graficar los datos de un archivo de texto .dat (Están encerrados "" y separados con ;) para lo cual he leído y guardado mis datos en mysql e intento graficarlos con las librerias de highcharts y php, pero por alguna razón solo me muestra una gráfica en blanco.
Les adjunto mi código, ojalá puedan darle un vistazo:

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
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
<?php
require_once("connection.php");
?>
 
<!DOCTYPE HTML>
<html>
	<head>
		<meta http-equiv="Content-Type" content="text/html; charset=utf-8">
		<title>Highcharts Example</title>
 
		<style type="text/css">
#container {
	min-width: 310px;
	max-width: 800px;
	height: 400px;
	margin: 0 auto
}
		</style>
	</head>
	<body>
<script src="../../code/highcharts.js"></script>
<script src="../../code/modules/exporting.js"></script>
 
<div id="container"></div>
 
 
 
		<script type="text/javascript">
 
Highcharts.chart('container', {
 
    title: {
        text: 'Reporte de instrumentos'
    },
 
    subtitle: {
        text: 'Source: TÍTULO'
    },
 
    yAxis: {
        title: {
            text: 'Number of Employees'
        }
    },
    legend: {
        layout: 'vertical',
        align: 'right',
        verticalAlign: 'middle'
    },
    xAxis: {
        categories: [
        <?php
        $sql = "SELECT * FROM location";
        $result = mysqli_query($connection, $sql);
        while ( $mysql = mysqli_fetch_array($result, MYSQL_ASSOC))
        {
        ?>
                '<?php echo preg_replace("/\"(\d+)\"/", '$1',$mysql["FECHA"]) ?>',
            <?php
 
            }
            ?>
        ]
    },
    //plotOptions: {
      //  series: {
            //pointStart: 2010
 
        //}
    //},
 
    series: [{
        name: 'P1A_Bunits',
        data: [
        <?php
        $sql = "SELECT * FROM location";
        $result = mysqli_query($connection, $sql);
        while ( $mysql = mysqli_fetch_array(integer.parseInt($result), MYSQL_ASSOC))
        {
        ?>
                <?php echo preg_replace("/\"(\d+)\"/", '$1', $mysql ["P1A_Bunits"]); ?>,
            <?php
 
            }
            ?>
 
            ]
 
    }, ]
 
});
		</script>
	</body>
</html>
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