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 95 96 97 98 99 100 101 102 103 104 105 106 107 108 109 110 111 112 113 114 115 116 117 118 119 120 121 122 123 124 125 126 127 128 129 130 131
| <html>
<head>
<title>Premier test de Highcharts </title>
<script type="text/javascript" src="./js/jquery.min.js"></script>
<link rel="stylesheet" href="style.css" />
<script src="./js/highstock.js"></script>
<script src="./js/modules/exporting.js"></script>
</head>
<body>
<?php
$date = date("d-m-Y");
$heure = date("H:i");
Print("Nous sommes le $date et il est $heure");
?>
<meta http-equiv="Content-Type" content="text/html; charset=utf-8">
<pre class="brush:jscript;">
<script type="text/javascript">
$(function() {
$.getJSON('data.json', function(data) {
var H1 = [];
for (var i=0;i<data.length;i++) {
H1.push([data[i][0],data[i][1]]);
}
// Create a timer
var start = + new Date();
// Create the chart
$('#container').highcharts('StockChart',{
chart : {
// Affichage temps chargement
events: {
load: function(chart) {
this.setTitle(null, {
text: 'Graphique généré en : '+ (new Date() - start) +'ms'
});
}
},
zoomType: 'x'
//renderTo : 'container'
},
rangeSelector : {
inputEnabled: $('#container').width() > 144,
buttons: [{
type: 'day',
count: 1,
text: '1j'
}, {
type: 'day',
count: 2,
text: '2j'
}, {
type: 'day',
count: 3,
text: '3j'
}, {
type: 'week',
count: 1,
text: '1s'
}, {
type: 'month',
count: 1,
text: '1m'
}, {
type: 'month',
count: 6,
text: '6m'
}, {
type: 'year',
count: 1,
text: '1a'
}, {
type: 'all',
text: 'tout'
}],
selected: 1
},
yAxis: {
title: {
text: 'Hauteur d\'eau'
}
//min: -20,
//max: 40
//startOnTick: false,
//endOnTick: false
},
title : {
text : 'Mesures de hauteur d\'eau'
},
legend: {
enabled: true,
align: 'center',
layout: 'horizontal',
verticalAlign: 'bottom',
},
series : [{
name : 'Hauteur d\'eau',
data : H1,
color: '#008000',
type: 'spline',
tooltip: {
valueDecimals: 2,
valueSuffix: 'm'
}
}
]
});
});
});
</script>
<div id="container" style="height: 700px; min-width: 500px"></div>
</body>
</html> |
Partager