Permalink
Browse files

type/default: optionally draw min/max spikes in a lighter color in gr…

…aphs

Closes #73
  • Loading branch information...
pommi committed Jul 5, 2014
1 parent 2e28b18 commit 786f0e715dc6fda1b4dc72e7033f280adde24283
Showing with 8 additions and 4 deletions.
  1. +3 −0 conf/config.php
  2. +2 −0 type/Base.class.php
  3. +3 −4 type/Default.class.php
@@ -62,6 +62,9 @@
# create smooth graphs (rrdtool -E)
$CONFIG['graph_smooth'] = false;
# draw min/max spikes in a lighter color in graphs with type default
$CONFIG['graph_minmax'] = false;
# browser cache time for the graphs (in seconds)
$CONFIG['cache'] = 90;
@@ -24,6 +24,7 @@ class Type_Base {
var $negative_io;
var $percentile = false;
var $graph_smooth;
var $graph_minmax;
var $files;
var $tinstances;
@@ -57,6 +58,7 @@ function __construct($config, $_get) {
$this->graph_type = $config['graph_type'];
$this->negative_io = $config['negative_io'];
$this->graph_smooth = $config['graph_smooth'];
$this->graph_minmax = $config['graph_minmax'];
$this->flush_socket = $config['socket'];
$this->flush_type = $config['flush_type'];
}
@@ -35,13 +35,12 @@ function rrd_gen_graph() {
}
}
if(count($this->files)<=1) {
if ($this->graph_minmax) {
$c = 0;
foreach ($sources as $source) {
$color = is_array($this->colors) ? (isset($this->colors[$source])?$this->colors[$source]:$this->colors[$c++]): $this->colors;
$rrdgraph[] = sprintf('AREA:max_%s#%s', crc32hex($source), $this->get_faded_color($color));
$rrdgraph[] = sprintf('AREA:min_%s#%s', crc32hex($source), 'ffffff');
break; # only 1 area to draw
$rrdgraph[] = sprintf('LINE1:max_%s#%s', crc32hex($source), $this->get_faded_color($color));
$rrdgraph[] = sprintf('LINE1:min_%s#%s', crc32hex($source), $this->get_faded_color($color));
}
}

0 comments on commit 786f0e7

Please sign in to comment.