First version
[ampy.git] / html / graph.php
1 <?php
2 $RRDFILE="/home/nirgal/ampy/power.rrd";
3 $IMGFILE="/tmp/power.svg";
4 $REFRESH=30;
5
6 $result=rrd_graph("$IMGFILE", [
7         "--imgformat", "SVG",
8         "-s", "now-1h",
9         #"-e", "now-8h",
10         "--width", "1000",
11         "--height", "500",
12         "--vertical-label", "watts",
13         "--lower-limit", "0",
14         #"--logarithmic",
15         "DEF:watts=${RRDFILE}:watts:AVERAGE",
16         "LINE1:watts#FF0000"
17 ]);
18 if ($result === FALSE) {
19         echo("Error in rrd_graph");
20         die();
21 }
22 header("Content-Type: image/svg+xml");
23 #header("Refresh: $REFRESH");
24 readfile($IMGFILE);
25 ?>