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
|
<<script type="text/javascript">
google.charts.load('current', {'packages':['corechart']});
google.charts.setOnLoadCallback(graphtemp);
function graphtemp() {
var data = google.visualization.arrayToDataTable([
['Date', 'Maxi'],
<?php
mysqli_report(MYSQLI_REPORT_ERROR | MYSQLI_REPORT_STRICT);
$currentmois = date('m');
$currentyear = date('Y');
$chartQuery = "SELECT date_format(Date,'%d/%m %y ') AS datum, max(TmpExt) as TmpExt FROM DAVIS where YEAR(date)=$currentyear and MONTH(date)=$currentmois order by ID desc limit 31";
if (isset($_POST['SelecteurMoisTemperature'])) {
$timestamp = strtotime($_POST['SelecteurMoisTemperature']);
$Y = (int) date('Y', $timestamp);
$M = (int) date('m', $timestamp);
$d = (int) date('d-m-Y', $timestamp);
$YM = (int) date('Y-m', $timestamp);
$chartQuery = "SELECT *, Date_format(Date,'%d/%m/%Y') as datum ,max(TmpExt) as TmpExt FROM DAVIS where YEAR(Date)=$Y and MONTH(Date)= $M order by Date desc limit 31";
}
$chartQueryRecords = mysqli_query($connect, $chartQuery);
while ($row = mysqli_fetch_assoc($chartQueryRecords)) {
echo "['".$row['datum']."',".$row['TmpExt']."],";
}
?>
]);
var options = {
explorer: {
axis: 'horizontal',
keepInBounds: true,
maxZoomIn: 4.0
},
series: {
0: { color: '#D80010',},
1: { color: '#33FFF6' ,},
},
curveType:'function',
intervals: {style: 'bars', },
backgroundColor: 'transparent',
color: ['white'],
lineWidth: 4,
hAxis: { direction: -1,
format:'MMM d, y',
textStyle: { color:'white'},
},
vAxis: {
textStyle: {
color:'red',
},
explorer: {
axis: 'horizontal',
keepInBounds: true,
maxZoomIn: 4.0,
},
},
chartArea: {left : 100,
width: 1130},
legend: { position: 'top',
textStyle: {
color: 'white'},
}
};
var chart = new google.visualization.ColumnChart(document.getElementById('temp_chart'));
chart.draw(data, options);
}
</script> |
Partager