aboutsummaryrefslogtreecommitdiffstatshomepage
diff options
context:
space:
mode:
authorPim van den Berg2014-07-05 14:14:29 +0200
committerPim van den Berg2014-07-05 14:15:43 +0200
commit786f0e715dc6fda1b4dc72e7033f280adde24283 (patch)
tree1f5829be980e5b5aa0306da4307d5940c8171360
parentjsrrdgraph: RrdGraph.js: make HRULE support reference to variable (diff)
downloadapt-panopticon_cgp-786f0e715dc6fda1b4dc72e7033f280adde24283.zip
apt-panopticon_cgp-786f0e715dc6fda1b4dc72e7033f280adde24283.tar.gz
apt-panopticon_cgp-786f0e715dc6fda1b4dc72e7033f280adde24283.tar.bz2
apt-panopticon_cgp-786f0e715dc6fda1b4dc72e7033f280adde24283.tar.xz
type/default: optionally draw min/max spikes in a lighter color in graphs
Closes #73
-rw-r--r--conf/config.php3
-rw-r--r--type/Base.class.php2
-rw-r--r--type/Default.class.php7
3 files changed, 8 insertions, 4 deletions
diff --git a/conf/config.php b/conf/config.php
index e40cc9f..30eaaf9 100644
--- a/conf/config.php
+++ b/conf/config.php
@@ -62,6 +62,9 @@ $CONFIG['percentile'] = false;
62# create smooth graphs (rrdtool -E) 62# create smooth graphs (rrdtool -E)
63$CONFIG['graph_smooth'] = false; 63$CONFIG['graph_smooth'] = false;
64 64
65# draw min/max spikes in a lighter color in graphs with type default
66$CONFIG['graph_minmax'] = false;
67
65# browser cache time for the graphs (in seconds) 68# browser cache time for the graphs (in seconds)
66$CONFIG['cache'] = 90; 69$CONFIG['cache'] = 90;
67 70
diff --git a/type/Base.class.php b/type/Base.class.php
index 34e182f..5af4c29 100644
--- a/type/Base.class.php
+++ b/type/Base.class.php
@@ -24,6 +24,7 @@ class Type_Base {
24 var $negative_io; 24 var $negative_io;
25 var $percentile = false; 25 var $percentile = false;
26 var $graph_smooth; 26 var $graph_smooth;
27 var $graph_minmax;
27 28
28 var $files; 29 var $files;
29 var $tinstances; 30 var $tinstances;
@@ -57,6 +58,7 @@ class Type_Base {
57 $this->graph_type = $config['graph_type']; 58 $this->graph_type = $config['graph_type'];
58 $this->negative_io = $config['negative_io']; 59 $this->negative_io = $config['negative_io'];
59 $this->graph_smooth = $config['graph_smooth']; 60 $this->graph_smooth = $config['graph_smooth'];
61 $this->graph_minmax = $config['graph_minmax'];
60 $this->flush_socket = $config['socket']; 62 $this->flush_socket = $config['socket'];
61 $this->flush_type = $config['flush_type']; 63 $this->flush_type = $config['flush_type'];
62 } 64 }
diff --git a/type/Default.class.php b/type/Default.class.php
index 9f3b97a..6e7efd9 100644
--- a/type/Default.class.php
+++ b/type/Default.class.php
@@ -35,13 +35,12 @@ class Type_Default extends Type_Base {
35 } 35 }
36 } 36 }
37 37
38 if(count($this->files)<=1) { 38 if ($this->graph_minmax) {
39 $c = 0; 39 $c = 0;
40 foreach ($sources as $source) { 40 foreach ($sources as $source) {
41 $color = is_array($this->colors) ? (isset($this->colors[$source])?$this->colors[$source]:$this->colors[$c++]): $this->colors; 41 $color = is_array($this->colors) ? (isset($this->colors[$source])?$this->colors[$source]:$this->colors[$c++]): $this->colors;
42 $rrdgraph[] = sprintf('AREA:max_%s#%s', crc32hex($source), $this->get_faded_color($color)); 42 $rrdgraph[] = sprintf('LINE1:max_%s#%s', crc32hex($source), $this->get_faded_color($color));
43 $rrdgraph[] = sprintf('AREA:min_%s#%s', crc32hex($source), 'ffffff'); 43 $rrdgraph[] = sprintf('LINE1:min_%s#%s', crc32hex($source), $this->get_faded_color($color));
44 break; # only 1 area to draw
45 } 44 }
46 } 45 }
47 46