aboutsummaryrefslogtreecommitdiffstatshomepage
path: root/type
diff options
context:
space:
mode:
authorManuel CISSÉ2010-02-23 17:09:07 +0100
committerPim van den Berg2010-03-01 20:43:24 +0100
commit311b225b6c08fb13bdd6f4d9746338712df1ffcb (patch)
tree9105013162fdf515a8bdf387bbec127eb1d0c9e6 /type
parentadd the ability to graph multiple DS in multiple files (used by vmem plugin) (diff)
downloadapt-panopticon_cgp-311b225b6c08fb13bdd6f4d9746338712df1ffcb.zip
apt-panopticon_cgp-311b225b6c08fb13bdd6f4d9746338712df1ffcb.tar.gz
apt-panopticon_cgp-311b225b6c08fb13bdd6f4d9746338712df1ffcb.tar.bz2
apt-panopticon_cgp-311b225b6c08fb13bdd6f4d9746338712df1ffcb.tar.xz
autofill DS names when not specified
Diffstat (limited to 'type')
-rw-r--r--type/Default.class.php18
1 files changed, 18 insertions, 0 deletions
diff --git a/type/Default.class.php b/type/Default.class.php
index f15ca32..0eab459 100644
--- a/type/Default.class.php
+++ b/type/Default.class.php
@@ -167,9 +167,27 @@ class Type_Default {
167 # use data_sources as sources 167 # use data_sources as sources
168 $sources = $this->data_sources; 168 $sources = $this->data_sources;
169 } 169 }
170 $this->fill_ds_names($sources);
170 return $sources; 171 return $sources;
171 } 172 }
172 173
174 function fill_ds_names($sources) {
175 $max = 0;
176 foreach ($sources as $source) {
177 if(strlen($source) > $max) {
178 $max = strlen($source);
179 }
180 }
181 if($max > 0) {
182 $fmt = sprintf("%%-%ds", $max);
183 foreach ($sources as $source) {
184 if(!isset($this->ds_names[$source])) {
185 $this->ds_names[$source] = sprintf($fmt, $source);
186 }
187 }
188 }
189 }
190
173 function rrd_gen_graph() { 191 function rrd_gen_graph() {
174 $rrdgraph = $this->rrd_options(); 192 $rrdgraph = $this->rrd_options();
175 193