Wykres ma służyć do prezentowania danych zgromadzonych przez termometr higrometr i barometr na mojej stronie www.
Skrypt wykresu:
[js]
jQuery.noConflict();
</script>
<link href="css/meteo.css" rel="stylesheet" type="text/css" />
<script type="text/javascript">
(function($){ // encapsulate jQuery
var chart;
$(document).ready(function() {
chart = new Highcharts.Chart({
chart: {
renderTo: 'meteo-container',
zoomType: 'xy'
},
title: {
text: 'Projekt: Domowa stacja meteo.'
},
subtitle: {
text: ' '
},
xAxis: [{
categories: ['04:00', '04:30', '05:00', '05:30', '06:00', '06:30','07:00', '07:30', '8:00', '8:30', '9:00', '9:30','10:00']/*TU CHCĘ PODSTAWIĆ DANE Z BAZY MYSQL*/
}],
yAxis: [{ // Primary yAxis
labels: {
formatter: function() {
return this.value +'°C';
},
style: {
color: '#89A54E'
}
},
title: {
text: 'Temperatura',
style: {
color: '#89A54E'
}
},
opposite: true
}, { // Secondary yAxis
gridLineWidth: 0,
title: {
text: 'Wilgotność (Higrometr)',
style: {
color: '#4572A7'
}
},
labels: {
formatter: function() {
return this.value +' %';
},
style: {
color: '#4572A7'
}
}
}, { // Tertiary yAxis
gridLineWidth: 0,
title: {
text: 'Ciśnienie',
style: {
color: '#AA4643'
}
},
labels: {
formatter: function() {
return this.value +' hp';
},
style: {
color: '#AA4643'
}
},
opposite: true
}],
tooltip: {
formatter: function() {
var unit = {
'Wilgotność':' %',
'Temperatura': '°C',
'Ciśnienie': 'hP'
}[this.series.name];
return ''+
this.x +': '+ this.y +' '+ unit;
}
},
legend: {
layout: 'vertical',
align: 'left',
x: 220,
verticalAlign: 'top',
y: 80,
floating: true,
backgroundColor: '#FFFFFF'
},
series: [{
name: 'Wilgotność',
color: '#4572A7',
type: 'column',
yAxis: 1,
data: [40, 50, 51, 52, 52.098, 53.099, 95, 97, 99, 30, 95.6, 94.4,80] /*TU CHCĘ PODSTAWIĆ DANE Z BAZY MYSQL*/
}, {
name: 'Ciśnienie',
type: 'spline',
color: '#AA4643',
yAxis: 2,
data: [1016, 1016, 1015.9, 1015.5, 1012.3, 1009.5, 1009.6, 1010.2, 1013.1, 1016.9, 1018.2, 1016.7,945], /*TU CHCĘ PODSTAWIĆ DANE Z BAZY MYSQL*/
marker: {
enabled: false
},
dashStyle: 'shortdot'
}, {
name: 'Temperatura',
color: '#89A54E',
type: 'spline',
data: [-7.0, 6.9, 9.5, 14.5, 18.2, 21.5, 25.2, -26.5, 23.3, 18.3, 13.9, 9.6,10]/*TU CHCĘ PODSTAWIĆ DANE Z BAZY MYSQL*/
}]
});
});
})(jQuery);
</script>
[/js]
Wykres zaadoptowany z
tej strony.