aboutsummaryrefslogtreecommitdiffstatshomepage
path: root/type/GenericStacked.class.php
diff options
context:
space:
mode:
authorManuel CISSÉ2010-02-23 17:14:49 +0100
committerPim van den Berg2010-03-01 20:55:15 +0100
commit78b253f756cb2aff93dc3291fd46d419e54861ab (patch)
tree1385b191181365b939f81d95296111e364ed6bd6 /type/GenericStacked.class.php
parentautofill DS names when not specified (diff)
downloadapt-panopticon_cgp-78b253f756cb2aff93dc3291fd46d419e54861ab.zip
apt-panopticon_cgp-78b253f756cb2aff93dc3291fd46d419e54861ab.tar.gz
apt-panopticon_cgp-78b253f756cb2aff93dc3291fd46d419e54861ab.tar.bz2
apt-panopticon_cgp-78b253f756cb2aff93dc3291fd46d419e54861ab.tar.xz
add the possibility to generate and use default colors for graphs
Diffstat (limited to 'type/GenericStacked.class.php')
-rw-r--r--type/GenericStacked.class.php8
1 files changed, 6 insertions, 2 deletions
diff --git a/type/GenericStacked.class.php b/type/GenericStacked.class.php
index 89e9f65..e9213de 100644
--- a/type/GenericStacked.class.php
+++ b/type/GenericStacked.class.php
@@ -26,14 +26,18 @@ class Type_GenericStacked extends Type_Default {
26 $rrdgraph[] = sprintf('CDEF:area_%s=area_%s,avg_%1$s,+', crc32hex($sources[$i]), crc32hex($sources[$i+1])); 26 $rrdgraph[] = sprintf('CDEF:area_%s=area_%s,avg_%1$s,+', crc32hex($sources[$i]), crc32hex($sources[$i+1]));
27 } 27 }
28 28
29 $c = 0;
29 foreach ($sources as $source) { 30 foreach ($sources as $source) {
30 $color = $this->get_faded_color($this->colors[$source]); 31 $color = is_array($this->colors) ? (isset($this->colors[$source])?$this->colors[$source]:$this->colors[$c++]) : $this->colors;
32 $color = $this->get_faded_color($color);
31 $rrdgraph[] = sprintf('AREA:area_%s#%s', crc32hex($source), $color); 33 $rrdgraph[] = sprintf('AREA:area_%s#%s', crc32hex($source), $color);
32 } 34 }
33 35
36 $c = 0;
34 foreach ($sources as $source) { 37 foreach ($sources as $source) {
35 $dsname = $this->ds_names[$source] != '' ? $this->ds_names[$source] : $source; 38 $dsname = $this->ds_names[$source] != '' ? $this->ds_names[$source] : $source;
36 $rrdgraph[] = sprintf('LINE1:area_%s#%s:\'%s\'', crc32hex($source), $this->validate_color($this->colors[$source]), $dsname); 39 $color = is_array($this->colors) ? (isset($this->colors[$source])?$this->colors[$source]:$this->colors[$c++]) : $this->colors;
40 $rrdgraph[] = sprintf('LINE1:area_%s#%s:\'%s\'', crc32hex($source), $this->validate_color($color), $dsname);
37 $rrdgraph[] = sprintf('GPRINT:min_%s:MIN:\'%s Min,\'', crc32hex($source), $this->rrd_format); 41 $rrdgraph[] = sprintf('GPRINT:min_%s:MIN:\'%s Min,\'', crc32hex($source), $this->rrd_format);
38 $rrdgraph[] = sprintf('GPRINT:avg_%s:AVERAGE:\'%s Avg,\'', crc32hex($source), $this->rrd_format); 42 $rrdgraph[] = sprintf('GPRINT:avg_%s:AVERAGE:\'%s Avg,\'', crc32hex($source), $this->rrd_format);
39 $rrdgraph[] = sprintf('GPRINT:max_%s:MAX:\'%s Max,\'', crc32hex($source), $this->rrd_format); 43 $rrdgraph[] = sprintf('GPRINT:max_%s:MAX:\'%s Max,\'', crc32hex($source), $this->rrd_format);