Código PHP:
<?php
include('../Datos.php');
$user = 'xxx';
$pass = 'xxx';
$url = 'localhost';
$con = mysql_connect($url,$user,$pass);
mysql_select_db('Meteo',$con);
$resultado1= mysql_query("SELECT * FROM Regsitros WHERE( Fecha ='$Dia') ORDER BY Hora ASC",$con);
$row = mysql_fetch_array($resultado1);
$resultado2 = $row['Fecha'];
$z = 0;
$total = mysql_num_rows($resultado1);
$total2 = $total++;
while ($z < $total2){
$hora[$z] = mysql_result($resultado1, $z, 'Hora');
$z++;
if ($z == $total2){
$z = 0;
break;
}
}
while ($z < $total2){
$temperatura[$z] = mysql_result($resultado1, $z, 'Temperatura');
$z++;
if ($z == $total2){
$z = 0;
break;
}
}
while ($z < $total2){
$sensacio[$z] = mysql_result($resultado1, $z, 'SensacionTermica');
$z++;
}
$x=0;
/*---------------------*/
while($x<$z){
$temp[$x] = trim($temperatura[$x]);
$x++;
}
$x=0;
while($x<$z){
$sens[$x] = trim($sensacio[$x]);
$x++;
}
$x=0;
while($x<$z){
$ho[$x] = trim($hora[$x]);
$x++;
}
$x=0;
/*---------------------*/
while ($x<$z){
if ($x == 0){
$t=$temp[$x].',';}
if ($x <> 0){
$t = $t.$temp[$x].',';}
$x++;
}
$x=0;
while ($x<$z){
if ($x == 0){
$s=$sens[$x].',';}
if ($x <> 0){
$s = $s.$sens[$x].',';}
$x++;
}
$x=0;
while ($x<$z){
if ($x == 0){
$h = $ho[$x].',';}
if ($x <> 0){
$h = $h.$ho[$x].',';}
$x++;
}
?>
<html>
<head>
<meta http-equiv="Content-Type" content="text/html; charset=utf-8">
<title>Gráfica Tempertaura - IES La Vereda (La Pobla de Vallbona)</title>
<script type="text/javascript" src="http://ajax.googleapis.com/ajax/libs/jquery/1.4.2/jquery.min.js"></script>
<script type="text/javascript" src="highcharts.js"></script>
<script type="text/javascript" src="../js/modules/exporting.js"></script>
<script type="text/javascript">
var chart;
$(document).ready(function() {
chart = new Highcharts.Chart({
chart: {
renderTo: 'container',
defaultSeriesType: 'spline'
},
title: {
text: 'Temperatura del <?=$resultado2;?>'
},
subtitle: {
text: 'Temperatura en Cº en La Pobla de Vallbona'
},
xAxis: {
categories: ['0','<?=$h;?>']
},
yAxis: {
title: {
text: 'Temperatura Cº'
},
labels: {
formatter: function() {
return this.value +'°'
}
}
},
tooltip: {
crosshairs: true,
shared: true
},
plotOptions: {
spline: {
marker: {
radius: 4,
lineColor: '#666666',
lineWidth: 1
}
}
},
series: [{
name: 'Sensación Térmica',
marker: {
symbol: 'circle'
},
data: [{
y: 5,
marker: {
symbol: 'url(min.png)'
}
},'<?=$t;?>']
}, {
name: 'Temperatura',
marker: {
symbol: 'square'
},
data: [{
y:1,
marker: {
symbol: 'url(max.png)'
}
},'<?=$s;?>']
}]
});
});
</script>
</head>
<body>
<div id="container" style="width: 800px; height: 400px; margin: 0 auto"></div>
</body>
</html>