author | Dan |
Sat, 10 Jan 2009 14:08:11 -0500 | |
changeset 49 | 4c4d69b2cd4d |
parent 44 | 73f74d395f95 |
permissions | -rw-r--r-- |
34
a8daa2016cf1
Added support for last month and last 2 weeks graphs; adjusted web interface accordingly
Dan
parents:
diff
changeset
|
1 |
<?php |
a8daa2016cf1
Added support for last month and last 2 weeks graphs; adjusted web interface accordingly
Dan
parents:
diff
changeset
|
2 |
require('../stats-fe.php'); |
a8daa2016cf1
Added support for last month and last 2 weeks graphs; adjusted web interface accordingly
Dan
parents:
diff
changeset
|
3 |
require('../graphs.php'); |
a8daa2016cf1
Added support for last month and last 2 weeks graphs; adjusted web interface accordingly
Dan
parents:
diff
changeset
|
4 |
require('../timezone.php'); |
a8daa2016cf1
Added support for last month and last 2 weeks graphs; adjusted web interface accordingly
Dan
parents:
diff
changeset
|
5 |
|
a8daa2016cf1
Added support for last month and last 2 weeks graphs; adjusted web interface accordingly
Dan
parents:
diff
changeset
|
6 |
$channel_list = stats_channel_list(); |
a8daa2016cf1
Added support for last month and last 2 weeks graphs; adjusted web interface accordingly
Dan
parents:
diff
changeset
|
7 |
$first_channel = $channel_list[0]; |
a8daa2016cf1
Added support for last month and last 2 weeks graphs; adjusted web interface accordingly
Dan
parents:
diff
changeset
|
8 |
$channel = ( isset($_REQUEST['channel']) && in_array($_REQUEST['channel'], $channel_list) ) ? $_REQUEST['channel'] : $first_channel; |
a8daa2016cf1
Added support for last month and last 2 weeks graphs; adjusted web interface accordingly
Dan
parents:
diff
changeset
|
9 |
|
43
ce2e9caf2dfa
Added support for different types of graphs; added a last 60 minutes line graph
Dan
parents:
34
diff
changeset
|
10 |
function makeGraph($type = 'bar') |
ce2e9caf2dfa
Added support for different types of graphs; added a last 60 minutes line graph
Dan
parents:
34
diff
changeset
|
11 |
{ |
44
73f74d395f95
Added theme support. Oh yeah, you can customize graphs using graph_{line,bar}.def.
Dan
parents:
43
diff
changeset
|
12 |
global $webtheme; |
73f74d395f95
Added theme support. Oh yeah, you can customize graphs using graph_{line,bar}.def.
Dan
parents:
43
diff
changeset
|
13 |
|
43
ce2e9caf2dfa
Added support for different types of graphs; added a last 60 minutes line graph
Dan
parents:
34
diff
changeset
|
14 |
$class = ( $type == 'line' ) ? 'LineGraph' : 'BarGraph'; |
ce2e9caf2dfa
Added support for different types of graphs; added a last 60 minutes line graph
Dan
parents:
34
diff
changeset
|
15 |
$g = new $class(); // _Compat(); |
ce2e9caf2dfa
Added support for different types of graphs; added a last 60 minutes line graph
Dan
parents:
34
diff
changeset
|
16 |
|
ce2e9caf2dfa
Added support for different types of graphs; added a last 60 minutes line graph
Dan
parents:
34
diff
changeset
|
17 |
$g->SetGraphAreaHeight(200); |
ce2e9caf2dfa
Added support for different types of graphs; added a last 60 minutes line graph
Dan
parents:
34
diff
changeset
|
18 |
$g->SetGraphPadding(30, 30, 20, 15); |
ce2e9caf2dfa
Added support for different types of graphs; added a last 60 minutes line graph
Dan
parents:
34
diff
changeset
|
19 |
if ( get_class($g) == 'BarGraph' ) |
ce2e9caf2dfa
Added support for different types of graphs; added a last 60 minutes line graph
Dan
parents:
34
diff
changeset
|
20 |
{ |
ce2e9caf2dfa
Added support for different types of graphs; added a last 60 minutes line graph
Dan
parents:
34
diff
changeset
|
21 |
$g->SetBarPadding(7); |
ce2e9caf2dfa
Added support for different types of graphs; added a last 60 minutes line graph
Dan
parents:
34
diff
changeset
|
22 |
$g->SetBarFont(1); |
ce2e9caf2dfa
Added support for different types of graphs; added a last 60 minutes line graph
Dan
parents:
34
diff
changeset
|
23 |
$g->SetBarDimensions(25, 7); |
ce2e9caf2dfa
Added support for different types of graphs; added a last 60 minutes line graph
Dan
parents:
34
diff
changeset
|
24 |
} |
ce2e9caf2dfa
Added support for different types of graphs; added a last 60 minutes line graph
Dan
parents:
34
diff
changeset
|
25 |
else if ( get_class($g) == 'LineGraph' ) |
ce2e9caf2dfa
Added support for different types of graphs; added a last 60 minutes line graph
Dan
parents:
34
diff
changeset
|
26 |
{ |
ce2e9caf2dfa
Added support for different types of graphs; added a last 60 minutes line graph
Dan
parents:
34
diff
changeset
|
27 |
$g->SetGraphAreaWidth(800); |
ce2e9caf2dfa
Added support for different types of graphs; added a last 60 minutes line graph
Dan
parents:
34
diff
changeset
|
28 |
} |
ce2e9caf2dfa
Added support for different types of graphs; added a last 60 minutes line graph
Dan
parents:
34
diff
changeset
|
29 |
$g->SetAxisDeepness(7); |
ce2e9caf2dfa
Added support for different types of graphs; added a last 60 minutes line graph
Dan
parents:
34
diff
changeset
|
30 |
$g->SetGraphTitleFont(2); |
ce2e9caf2dfa
Added support for different types of graphs; added a last 60 minutes line graph
Dan
parents:
34
diff
changeset
|
31 |
$g->SetGraphBackgroundTransparent(false, 240, 250, 255); |
ce2e9caf2dfa
Added support for different types of graphs; added a last 60 minutes line graph
Dan
parents:
34
diff
changeset
|
32 |
$g->SetGraphTransparency(25); |
ce2e9caf2dfa
Added support for different types of graphs; added a last 60 minutes line graph
Dan
parents:
34
diff
changeset
|
33 |
$g->SetAxisScaleColor(90, 90, 90); |
ce2e9caf2dfa
Added support for different types of graphs; added a last 60 minutes line graph
Dan
parents:
34
diff
changeset
|
34 |
$g->SetAxisScaleFont(1); |
ce2e9caf2dfa
Added support for different types of graphs; added a last 60 minutes line graph
Dan
parents:
34
diff
changeset
|
35 |
$g->SetScaleRoundY(0); |
ce2e9caf2dfa
Added support for different types of graphs; added a last 60 minutes line graph
Dan
parents:
34
diff
changeset
|
36 |
$g->SetScaleRoundX(0); |
ce2e9caf2dfa
Added support for different types of graphs; added a last 60 minutes line graph
Dan
parents:
34
diff
changeset
|
37 |
$g->SetAxisStepSize(7); |
44
73f74d395f95
Added theme support. Oh yeah, you can customize graphs using graph_{line,bar}.def.
Dan
parents:
43
diff
changeset
|
38 |
|
73f74d395f95
Added theme support. Oh yeah, you can customize graphs using graph_{line,bar}.def.
Dan
parents:
43
diff
changeset
|
39 |
if ( file_exists("./themes/$webtheme/graph_$type.def") ) |
73f74d395f95
Added theme support. Oh yeah, you can customize graphs using graph_{line,bar}.def.
Dan
parents:
43
diff
changeset
|
40 |
$g->LoadGraph(realpath("./themes/$webtheme/graph_$type.def")); |
73f74d395f95
Added theme support. Oh yeah, you can customize graphs using graph_{line,bar}.def.
Dan
parents:
43
diff
changeset
|
41 |
|
43
ce2e9caf2dfa
Added support for different types of graphs; added a last 60 minutes line graph
Dan
parents:
34
diff
changeset
|
42 |
return $g; |
ce2e9caf2dfa
Added support for different types of graphs; added a last 60 minutes line graph
Dan
parents:
34
diff
changeset
|
43 |
} |
34
a8daa2016cf1
Added support for last month and last 2 weeks graphs; adjusted web interface accordingly
Dan
parents:
diff
changeset
|
44 |
|
a8daa2016cf1
Added support for last month and last 2 weeks graphs; adjusted web interface accordingly
Dan
parents:
diff
changeset
|
45 |
// generate the data |
a8daa2016cf1
Added support for last month and last 2 weeks graphs; adjusted web interface accordingly
Dan
parents:
diff
changeset
|
46 |
// we're doing this by absolute hours, not by strictly "24 hours ago", e.g. on-the-hour stats |
a8daa2016cf1
Added support for last month and last 2 weeks graphs; adjusted web interface accordingly
Dan
parents:
diff
changeset
|
47 |
$mode = ( isset($_GET['mode']) ) ? $_GET['mode'] : 'lastday'; |
a8daa2016cf1
Added support for last month and last 2 weeks graphs; adjusted web interface accordingly
Dan
parents:
diff
changeset
|
48 |
switch ( $mode ) |
a8daa2016cf1
Added support for last month and last 2 weeks graphs; adjusted web interface accordingly
Dan
parents:
diff
changeset
|
49 |
{ |
a8daa2016cf1
Added support for last month and last 2 weeks graphs; adjusted web interface accordingly
Dan
parents:
diff
changeset
|
50 |
case 'lastday': |
a8daa2016cf1
Added support for last month and last 2 weeks graphs; adjusted web interface accordingly
Dan
parents:
diff
changeset
|
51 |
default: |
43
ce2e9caf2dfa
Added support for different types of graphs; added a last 60 minutes line graph
Dan
parents:
34
diff
changeset
|
52 |
$g = makeGraph(); |
34
a8daa2016cf1
Added support for last month and last 2 weeks graphs; adjusted web interface accordingly
Dan
parents:
diff
changeset
|
53 |
$graph_title = $channel . ' message count - last 24 hours'; |
a8daa2016cf1
Added support for last month and last 2 weeks graphs; adjusted web interface accordingly
Dan
parents:
diff
changeset
|
54 |
$this_hour = gmmktime(gmdate('H'), 0, 0); |
a8daa2016cf1
Added support for last month and last 2 weeks graphs; adjusted web interface accordingly
Dan
parents:
diff
changeset
|
55 |
$graphdata = array(); |
a8daa2016cf1
Added support for last month and last 2 weeks graphs; adjusted web interface accordingly
Dan
parents:
diff
changeset
|
56 |
|
a8daa2016cf1
Added support for last month and last 2 weeks graphs; adjusted web interface accordingly
Dan
parents:
diff
changeset
|
57 |
for ( $i = 23; $i >= 0; $i-- ) |
a8daa2016cf1
Added support for last month and last 2 weeks graphs; adjusted web interface accordingly
Dan
parents:
diff
changeset
|
58 |
{ |
a8daa2016cf1
Added support for last month and last 2 weeks graphs; adjusted web interface accordingly
Dan
parents:
diff
changeset
|
59 |
$basetime = $this_hour - ( $i * 3600 ); |
a8daa2016cf1
Added support for last month and last 2 weeks graphs; adjusted web interface accordingly
Dan
parents:
diff
changeset
|
60 |
$ts = date('H:i', $basetime); |
a8daa2016cf1
Added support for last month and last 2 weeks graphs; adjusted web interface accordingly
Dan
parents:
diff
changeset
|
61 |
$basetime += 3600; |
a8daa2016cf1
Added support for last month and last 2 weeks graphs; adjusted web interface accordingly
Dan
parents:
diff
changeset
|
62 |
$graphdata[$ts] = stats_message_count($channel, 60, $basetime); |
a8daa2016cf1
Added support for last month and last 2 weeks graphs; adjusted web interface accordingly
Dan
parents:
diff
changeset
|
63 |
} |
a8daa2016cf1
Added support for last month and last 2 weeks graphs; adjusted web interface accordingly
Dan
parents:
diff
changeset
|
64 |
break; |
a8daa2016cf1
Added support for last month and last 2 weeks graphs; adjusted web interface accordingly
Dan
parents:
diff
changeset
|
65 |
case 'lastweek': |
43
ce2e9caf2dfa
Added support for different types of graphs; added a last 60 minutes line graph
Dan
parents:
34
diff
changeset
|
66 |
$g = makeGraph(); |
34
a8daa2016cf1
Added support for last month and last 2 weeks graphs; adjusted web interface accordingly
Dan
parents:
diff
changeset
|
67 |
$graph_title = $channel . ' activity - last 14 days'; |
a8daa2016cf1
Added support for last month and last 2 weeks graphs; adjusted web interface accordingly
Dan
parents:
diff
changeset
|
68 |
$this_day = gmmktime(0, 0, 0); |
a8daa2016cf1
Added support for last month and last 2 weeks graphs; adjusted web interface accordingly
Dan
parents:
diff
changeset
|
69 |
$graphdata = array(); |
a8daa2016cf1
Added support for last month and last 2 weeks graphs; adjusted web interface accordingly
Dan
parents:
diff
changeset
|
70 |
|
a8daa2016cf1
Added support for last month and last 2 weeks graphs; adjusted web interface accordingly
Dan
parents:
diff
changeset
|
71 |
for ( $i = 13; $i >= 0; $i-- ) |
a8daa2016cf1
Added support for last month and last 2 weeks graphs; adjusted web interface accordingly
Dan
parents:
diff
changeset
|
72 |
{ |
a8daa2016cf1
Added support for last month and last 2 weeks graphs; adjusted web interface accordingly
Dan
parents:
diff
changeset
|
73 |
$basetime = $this_day - ( $i * 86400 ); |
a8daa2016cf1
Added support for last month and last 2 weeks graphs; adjusted web interface accordingly
Dan
parents:
diff
changeset
|
74 |
$ts = date('D n/j', $basetime); |
a8daa2016cf1
Added support for last month and last 2 weeks graphs; adjusted web interface accordingly
Dan
parents:
diff
changeset
|
75 |
$basetime += 86400; |
a8daa2016cf1
Added support for last month and last 2 weeks graphs; adjusted web interface accordingly
Dan
parents:
diff
changeset
|
76 |
$graphdata[$ts] = stats_message_count($channel, 1440, $basetime); |
a8daa2016cf1
Added support for last month and last 2 weeks graphs; adjusted web interface accordingly
Dan
parents:
diff
changeset
|
77 |
} |
a8daa2016cf1
Added support for last month and last 2 weeks graphs; adjusted web interface accordingly
Dan
parents:
diff
changeset
|
78 |
$g->SetBarPadding(12); |
a8daa2016cf1
Added support for last month and last 2 weeks graphs; adjusted web interface accordingly
Dan
parents:
diff
changeset
|
79 |
break; |
a8daa2016cf1
Added support for last month and last 2 weeks graphs; adjusted web interface accordingly
Dan
parents:
diff
changeset
|
80 |
case 'lastmonth': |
43
ce2e9caf2dfa
Added support for different types of graphs; added a last 60 minutes line graph
Dan
parents:
34
diff
changeset
|
81 |
$g = makeGraph(); |
34
a8daa2016cf1
Added support for last month and last 2 weeks graphs; adjusted web interface accordingly
Dan
parents:
diff
changeset
|
82 |
$graph_title = $channel . ' activity - last 30 days'; |
a8daa2016cf1
Added support for last month and last 2 weeks graphs; adjusted web interface accordingly
Dan
parents:
diff
changeset
|
83 |
$this_day = gmmktime(0, 0, 0); |
a8daa2016cf1
Added support for last month and last 2 weeks graphs; adjusted web interface accordingly
Dan
parents:
diff
changeset
|
84 |
$graphdata = array(); |
a8daa2016cf1
Added support for last month and last 2 weeks graphs; adjusted web interface accordingly
Dan
parents:
diff
changeset
|
85 |
|
a8daa2016cf1
Added support for last month and last 2 weeks graphs; adjusted web interface accordingly
Dan
parents:
diff
changeset
|
86 |
for ( $i = 29; $i >= 0; $i-- ) |
a8daa2016cf1
Added support for last month and last 2 weeks graphs; adjusted web interface accordingly
Dan
parents:
diff
changeset
|
87 |
{ |
a8daa2016cf1
Added support for last month and last 2 weeks graphs; adjusted web interface accordingly
Dan
parents:
diff
changeset
|
88 |
$basetime = $this_day - ( $i * 86400 ); |
a8daa2016cf1
Added support for last month and last 2 weeks graphs; adjusted web interface accordingly
Dan
parents:
diff
changeset
|
89 |
$ts = date('Y-m-d', $basetime); |
a8daa2016cf1
Added support for last month and last 2 weeks graphs; adjusted web interface accordingly
Dan
parents:
diff
changeset
|
90 |
$basetime += 86400; |
a8daa2016cf1
Added support for last month and last 2 weeks graphs; adjusted web interface accordingly
Dan
parents:
diff
changeset
|
91 |
$graphdata[$ts] = stats_message_count($channel, 1440, $basetime); |
a8daa2016cf1
Added support for last month and last 2 weeks graphs; adjusted web interface accordingly
Dan
parents:
diff
changeset
|
92 |
} |
a8daa2016cf1
Added support for last month and last 2 weeks graphs; adjusted web interface accordingly
Dan
parents:
diff
changeset
|
93 |
$g->SetBarPadding(15); |
a8daa2016cf1
Added support for last month and last 2 weeks graphs; adjusted web interface accordingly
Dan
parents:
diff
changeset
|
94 |
break; |
43
ce2e9caf2dfa
Added support for different types of graphs; added a last 60 minutes line graph
Dan
parents:
34
diff
changeset
|
95 |
case 'lasthour': |
ce2e9caf2dfa
Added support for different types of graphs; added a last 60 minutes line graph
Dan
parents:
34
diff
changeset
|
96 |
$g = makeGraph('line'); |
ce2e9caf2dfa
Added support for different types of graphs; added a last 60 minutes line graph
Dan
parents:
34
diff
changeset
|
97 |
$g->SetAxisStepX(5); |
ce2e9caf2dfa
Added support for different types of graphs; added a last 60 minutes line graph
Dan
parents:
34
diff
changeset
|
98 |
$g->SetScaleFunctionX('lasthour_scaler'); |
ce2e9caf2dfa
Added support for different types of graphs; added a last 60 minutes line graph
Dan
parents:
34
diff
changeset
|
99 |
function lasthour_scaler($v, $g) |
ce2e9caf2dfa
Added support for different types of graphs; added a last 60 minutes line graph
Dan
parents:
34
diff
changeset
|
100 |
{ |
ce2e9caf2dfa
Added support for different types of graphs; added a last 60 minutes line graph
Dan
parents:
34
diff
changeset
|
101 |
$k = array_keys($g->data); |
ce2e9caf2dfa
Added support for different types of graphs; added a last 60 minutes line graph
Dan
parents:
34
diff
changeset
|
102 |
return ( isset($k[$v]) ) ? $k[$v] : 'now'; |
ce2e9caf2dfa
Added support for different types of graphs; added a last 60 minutes line graph
Dan
parents:
34
diff
changeset
|
103 |
} |
ce2e9caf2dfa
Added support for different types of graphs; added a last 60 minutes line graph
Dan
parents:
34
diff
changeset
|
104 |
$graph_title = $channel . ' activity - last hour'; |
ce2e9caf2dfa
Added support for different types of graphs; added a last 60 minutes line graph
Dan
parents:
34
diff
changeset
|
105 |
$data = stats_raw_data($channel, 59); |
ce2e9caf2dfa
Added support for different types of graphs; added a last 60 minutes line graph
Dan
parents:
34
diff
changeset
|
106 |
$agg = array(); |
ce2e9caf2dfa
Added support for different types of graphs; added a last 60 minutes line graph
Dan
parents:
34
diff
changeset
|
107 |
foreach ( $data as $message ) |
ce2e9caf2dfa
Added support for different types of graphs; added a last 60 minutes line graph
Dan
parents:
34
diff
changeset
|
108 |
{ |
ce2e9caf2dfa
Added support for different types of graphs; added a last 60 minutes line graph
Dan
parents:
34
diff
changeset
|
109 |
$tid = intval(ltrim(date('i', $message['time']), '0')); |
ce2e9caf2dfa
Added support for different types of graphs; added a last 60 minutes line graph
Dan
parents:
34
diff
changeset
|
110 |
if ( !isset($agg[$tid]) ) |
ce2e9caf2dfa
Added support for different types of graphs; added a last 60 minutes line graph
Dan
parents:
34
diff
changeset
|
111 |
$agg[$tid] = 0; |
ce2e9caf2dfa
Added support for different types of graphs; added a last 60 minutes line graph
Dan
parents:
34
diff
changeset
|
112 |
$agg[$tid]++; |
ce2e9caf2dfa
Added support for different types of graphs; added a last 60 minutes line graph
Dan
parents:
34
diff
changeset
|
113 |
} |
ce2e9caf2dfa
Added support for different types of graphs; added a last 60 minutes line graph
Dan
parents:
34
diff
changeset
|
114 |
$graphdata = array(); |
ce2e9caf2dfa
Added support for different types of graphs; added a last 60 minutes line graph
Dan
parents:
34
diff
changeset
|
115 |
$minutenow = intval(ltrim(date('i', NOW), '0')); |
ce2e9caf2dfa
Added support for different types of graphs; added a last 60 minutes line graph
Dan
parents:
34
diff
changeset
|
116 |
$hournow = intval(ltrim(date('H', NOW), '0')); |
ce2e9caf2dfa
Added support for different types of graphs; added a last 60 minutes line graph
Dan
parents:
34
diff
changeset
|
117 |
$hourthen = intval(ltrim(date('H', NOW-3600), '0')); |
ce2e9caf2dfa
Added support for different types of graphs; added a last 60 minutes line graph
Dan
parents:
34
diff
changeset
|
118 |
for ( $i = $minutenow + 1; $i < 60; $i++ ) |
ce2e9caf2dfa
Added support for different types of graphs; added a last 60 minutes line graph
Dan
parents:
34
diff
changeset
|
119 |
{ |
ce2e9caf2dfa
Added support for different types of graphs; added a last 60 minutes line graph
Dan
parents:
34
diff
changeset
|
120 |
$istr = ( $i < 10 ) ? "0$i" : "$i"; |
ce2e9caf2dfa
Added support for different types of graphs; added a last 60 minutes line graph
Dan
parents:
34
diff
changeset
|
121 |
$graphdata["$hourthen:$istr"] = ( isset($agg[$i]) ) ? $agg[$i] : 0; |
ce2e9caf2dfa
Added support for different types of graphs; added a last 60 minutes line graph
Dan
parents:
34
diff
changeset
|
122 |
} |
ce2e9caf2dfa
Added support for different types of graphs; added a last 60 minutes line graph
Dan
parents:
34
diff
changeset
|
123 |
for ( $i = 0; $i <= $minutenow; $i++ ) |
ce2e9caf2dfa
Added support for different types of graphs; added a last 60 minutes line graph
Dan
parents:
34
diff
changeset
|
124 |
{ |
ce2e9caf2dfa
Added support for different types of graphs; added a last 60 minutes line graph
Dan
parents:
34
diff
changeset
|
125 |
$istr = ( $i < 10 ) ? "0$i" : "$i"; |
ce2e9caf2dfa
Added support for different types of graphs; added a last 60 minutes line graph
Dan
parents:
34
diff
changeset
|
126 |
$graphdata["$hournow:$istr"] = ( isset($agg[$i]) ) ? $agg[$i] : 0; |
ce2e9caf2dfa
Added support for different types of graphs; added a last 60 minutes line graph
Dan
parents:
34
diff
changeset
|
127 |
} |
ce2e9caf2dfa
Added support for different types of graphs; added a last 60 minutes line graph
Dan
parents:
34
diff
changeset
|
128 |
|
ce2e9caf2dfa
Added support for different types of graphs; added a last 60 minutes line graph
Dan
parents:
34
diff
changeset
|
129 |
break; |
34
a8daa2016cf1
Added support for last month and last 2 weeks graphs; adjusted web interface accordingly
Dan
parents:
diff
changeset
|
130 |
} |
a8daa2016cf1
Added support for last month and last 2 weeks graphs; adjusted web interface accordingly
Dan
parents:
diff
changeset
|
131 |
|
a8daa2016cf1
Added support for last month and last 2 weeks graphs; adjusted web interface accordingly
Dan
parents:
diff
changeset
|
132 |
$max = max($graphdata); |
a8daa2016cf1
Added support for last month and last 2 weeks graphs; adjusted web interface accordingly
Dan
parents:
diff
changeset
|
133 |
|
a8daa2016cf1
Added support for last month and last 2 weeks graphs; adjusted web interface accordingly
Dan
parents:
diff
changeset
|
134 |
// Determine axis interval |
a8daa2016cf1
Added support for last month and last 2 weeks graphs; adjusted web interface accordingly
Dan
parents:
diff
changeset
|
135 |
$interval = 2; |
a8daa2016cf1
Added support for last month and last 2 weeks graphs; adjusted web interface accordingly
Dan
parents:
diff
changeset
|
136 |
if ( $max > 20 ) |
a8daa2016cf1
Added support for last month and last 2 weeks graphs; adjusted web interface accordingly
Dan
parents:
diff
changeset
|
137 |
$interval = 4; |
a8daa2016cf1
Added support for last month and last 2 weeks graphs; adjusted web interface accordingly
Dan
parents:
diff
changeset
|
138 |
if ( $max > 25 ) |
a8daa2016cf1
Added support for last month and last 2 weeks graphs; adjusted web interface accordingly
Dan
parents:
diff
changeset
|
139 |
$interval = 5; |
a8daa2016cf1
Added support for last month and last 2 weeks graphs; adjusted web interface accordingly
Dan
parents:
diff
changeset
|
140 |
if ( $max > 50 ) |
a8daa2016cf1
Added support for last month and last 2 weeks graphs; adjusted web interface accordingly
Dan
parents:
diff
changeset
|
141 |
$interval = 10; |
a8daa2016cf1
Added support for last month and last 2 weeks graphs; adjusted web interface accordingly
Dan
parents:
diff
changeset
|
142 |
if ( $max > 200 ) |
a8daa2016cf1
Added support for last month and last 2 weeks graphs; adjusted web interface accordingly
Dan
parents:
diff
changeset
|
143 |
$interval = 40; |
a8daa2016cf1
Added support for last month and last 2 weeks graphs; adjusted web interface accordingly
Dan
parents:
diff
changeset
|
144 |
if ( $max > 500 ) |
a8daa2016cf1
Added support for last month and last 2 weeks graphs; adjusted web interface accordingly
Dan
parents:
diff
changeset
|
145 |
$interval = 80; |
a8daa2016cf1
Added support for last month and last 2 weeks graphs; adjusted web interface accordingly
Dan
parents:
diff
changeset
|
146 |
if ( $max > 1000 ) |
a8daa2016cf1
Added support for last month and last 2 weeks graphs; adjusted web interface accordingly
Dan
parents:
diff
changeset
|
147 |
$interval = 100; |
a8daa2016cf1
Added support for last month and last 2 weeks graphs; adjusted web interface accordingly
Dan
parents:
diff
changeset
|
148 |
if ( $max > 2000 ) |
a8daa2016cf1
Added support for last month and last 2 weeks graphs; adjusted web interface accordingly
Dan
parents:
diff
changeset
|
149 |
$interval = 200; |
a8daa2016cf1
Added support for last month and last 2 weeks graphs; adjusted web interface accordingly
Dan
parents:
diff
changeset
|
150 |
if ( $max > 3200 ) |
a8daa2016cf1
Added support for last month and last 2 weeks graphs; adjusted web interface accordingly
Dan
parents:
diff
changeset
|
151 |
$interval = 300; |
a8daa2016cf1
Added support for last month and last 2 weeks graphs; adjusted web interface accordingly
Dan
parents:
diff
changeset
|
152 |
if ( $max > 4000 ) |
a8daa2016cf1
Added support for last month and last 2 weeks graphs; adjusted web interface accordingly
Dan
parents:
diff
changeset
|
153 |
$interval = 500; |
a8daa2016cf1
Added support for last month and last 2 weeks graphs; adjusted web interface accordingly
Dan
parents:
diff
changeset
|
154 |
if ( $max > 5000 ) |
a8daa2016cf1
Added support for last month and last 2 weeks graphs; adjusted web interface accordingly
Dan
parents:
diff
changeset
|
155 |
$interval = 1000; |
a8daa2016cf1
Added support for last month and last 2 weeks graphs; adjusted web interface accordingly
Dan
parents:
diff
changeset
|
156 |
if ( $max > 15000 ) |
a8daa2016cf1
Added support for last month and last 2 weeks graphs; adjusted web interface accordingly
Dan
parents:
diff
changeset
|
157 |
$interval = 1500; |
a8daa2016cf1
Added support for last month and last 2 weeks graphs; adjusted web interface accordingly
Dan
parents:
diff
changeset
|
158 |
if ( $max > 30000 ) |
a8daa2016cf1
Added support for last month and last 2 weeks graphs; adjusted web interface accordingly
Dan
parents:
diff
changeset
|
159 |
$interval = round($max / 10); |
a8daa2016cf1
Added support for last month and last 2 weeks graphs; adjusted web interface accordingly
Dan
parents:
diff
changeset
|
160 |
|
43
ce2e9caf2dfa
Added support for different types of graphs; added a last 60 minutes line graph
Dan
parents:
34
diff
changeset
|
161 |
$g->data = $graphdata; |
ce2e9caf2dfa
Added support for different types of graphs; added a last 60 minutes line graph
Dan
parents:
34
diff
changeset
|
162 |
|
34
a8daa2016cf1
Added support for last month and last 2 weeks graphs; adjusted web interface accordingly
Dan
parents:
diff
changeset
|
163 |
$g->SetGraphTitle($graph_title); |
43
ce2e9caf2dfa
Added support for different types of graphs; added a last 60 minutes line graph
Dan
parents:
34
diff
changeset
|
164 |
$g->SetAxisStepY($interval); |
34
a8daa2016cf1
Added support for last month and last 2 weeks graphs; adjusted web interface accordingly
Dan
parents:
diff
changeset
|
165 |
|
a8daa2016cf1
Added support for last month and last 2 weeks graphs; adjusted web interface accordingly
Dan
parents:
diff
changeset
|
166 |
$g->DrawGraph(); |
a8daa2016cf1
Added support for last month and last 2 weeks graphs; adjusted web interface accordingly
Dan
parents:
diff
changeset
|
167 |