Blame view

util/index.php 2.75 KB
dbae34b1   rcavalie   début de l'applic...
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
  <!DOCTYPE html>
  <html>
  <head>
  <meta http-equiv="refresh" content="10">
  <title>Détection automatique de DoS</title>
  <script type="text/javascript" src="https://canvasjs.com/assets/script/jquery-1.11.1.min.js"></script>
  <script type="text/javascript" src="https://canvasjs.com/assets/script/canvasjs.min.js"></script>
  <script type="text/javascript">
      window.onload = function() {
          var dataPoints = [];
  
          function getDataPointsFromCSV(csv) {
              var dataPoints = csvLines = points = [];
              csvLines = csv.split(/[\r?\n|\r|\n]+/);
  
              for (var i = 0; i < csvLines.length; i++)
                  if (csvLines[i].length > 0) {
                      points = csvLines[i].split(",");
                      dataPoints.push({
                          x: parseFloat(points[0]),
                          y: parseFloat(points[1])
                      });
                  }
              return dataPoints;
          }
  
        	$.get("temperature.csv", function(data) {
        	    var chart = new CanvasJS.Chart("chartTemp", {
                axisY: {
                  title: "Température (Celsius)"
              	},
              	axisX: {
              		title: "Temps",
              		titleFontColor: "#4F81BC",
              		suffix: "s"
              	},
        		    data: [{
        		         type: "area",
                     color: "red",
        		         dataPoints: getDataPointsFromCSV(data)
        		      }]
        	     });
        	      chart.render();
        	});
  
          $.get("ping.csv", function(data) {
              var chart = new CanvasJS.Chart("chartPing", {
                axisY: {
                  title: "Ping (ms)"
                },
                axisX: {
                  title: "Temps",
                  titleFontColor: "#4F81BC",
                  suffix: "s"
                },
                data: [{
                     type: "area",
                     color: "blue",
                     dataPoints: getDataPointsFromCSV(data)
                  }]
               });
                chart.render();
          });
  
          $.get("puissance.csv", function(data) {
              var chart = new CanvasJS.Chart("chartPuissance", {
                axisY: {
                  title: "RSSI (dBm)"
                },
                axisX: {
                  title: "Temps",
                  titleFontColor: "#4F81BC",
                  suffix: "s"
                },
                data: [{
                     type: "area",
                     color: "green",
                     dataPoints: getDataPointsFromCSV(data)
                  }]
               });
                chart.render();
          });
    }
  </script>
  </head>
  <body>
  	<div id="chartTemp" style="width:70%; height:200px;"></div>
    <div id="chartPing" style="width:70%; height:200px;"></div>
    <div id="chartPuissance" style="width:70%; height:200px;"></div>
  </body>
  </html>