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
|
<script type='text/javascript'>
<!--
$(function ()
{
var seriesOptions = [],
seriesCounter = 0,
names = ['temp1', 'temp2', 'temp3', 'temp4', 'temp5', 'hygro1'];
var test = [
['<?php echo LANG_heating1; ?>',0,5,' <?php echo $_COOKIE['tempUnit']?>'],
['<?php echo LANG_heating2; ?>',0,4,' <?php echo $_COOKIE['tempUnit']?>'],
['<?php echo LANG_heating3; ?>',0,3,' <?php echo $_COOKIE['tempUnit']?>'],
['<?php echo LANG_heating4; ?>',0,2,' <?php echo $_COOKIE['tempUnit']?>'],
['<?php echo LANG_heating5; ?>',0,1,' <?php echo $_COOKIE['tempUnit']?>'],
['<?php echo LANG_hr; ?>',1,0,' %']
];
function createChart()
{
$('#temps_charts').highcharts('StockChart',
{
<?php include('scriptsJS/highstockOptions.js'); ?>
title: { text: '<?php echo LANG_temp; ?> - <?php echo LANG_hygro; ?>', x: 0 },
yAxis: [
{ // Primary yAxis
labels:
{
formatter: function() { return this.value +' <?php echo $_COOKIE['tempUnit']?>'; }
},
title: { text: '<?php echo LANG_temp; ?> (<?php echo $_COOKIE['tempUnit']?>)'},
plotLines: [{ value: 0, width: 1, color: '#808080' }]
},
{ // Secondary yAxis
gridLineWidth: 0,
labels:
{
formatter: function() { return this.value +' %'; },
style: { color: '#E3B071' }
},
title:
{
text: '<?php echo LANG_hygro; ?> (%)',
style: { color: '#E3B071' }
},
opposite: true
}
],
series: seriesOptions
});
}
$.each(names, function (i, name)
{
$.getJSON('http://192.168.1.211/scriptsPHP/json.php?filename=' + name + '.json&callback=?', function (data)
{
seriesOptions[i] =
{
name: test[i][0], data: data, type: 'spline', yAxis: test[i][1], zIndex: test[i][2], tooltip: { valueSuffix: test[i][3]}
};
seriesCounter += 1;
if (seriesCounter === names.length)
{
seriesCounter = 0;
createChart();
}
});
});
});
-->
</script> |
Partager