aboutsummaryrefslogtreecommitdiffstatshomepage
path: root/type/Base.class.php
diff options
context:
space:
mode:
authorPim van den Berg2014-05-03 18:15:12 +0200
committerPim van den Berg2014-05-03 19:21:36 +0200
commitedae75c21a8f657dd6cc9ace9e8e844ef337a951 (patch)
treeda0c2b4a1ef35a3d2d8c129925e257f6a6f7fbe3 /type/Base.class.php
parenttype/base: set default values for rrd_title and rrd_format (diff)
downloadapt-panopticon_cgp-edae75c21a8f657dd6cc9ace9e8e844ef337a951.zip
apt-panopticon_cgp-edae75c21a8f657dd6cc9ace9e8e844ef337a951.tar.gz
apt-panopticon_cgp-edae75c21a8f657dd6cc9ace9e8e844ef337a951.tar.bz2
apt-panopticon_cgp-edae75c21a8f657dd6cc9ace9e8e844ef337a951.tar.xz
rename ds_names and dsname to legend
This had nothing to do with an RRD data source.
Diffstat (limited to 'type/Base.class.php')
-rw-r--r--type/Base.class.php26
1 files changed, 13 insertions, 13 deletions
diff --git a/type/Base.class.php b/type/Base.class.php
index e1aae19..7c06e5d 100644
--- a/type/Base.class.php
+++ b/type/Base.class.php
@@ -11,7 +11,7 @@ class Type_Base {
11 var $seconds; 11 var $seconds;
12 var $data_sources = array('value'); 12 var $data_sources = array('value');
13 var $order; 13 var $order;
14 var $ds_names; 14 var $legend;
15 var $colors; 15 var $colors;
16 var $rrd_title; 16 var $rrd_title;
17 var $rrd_vertical; 17 var $rrd_vertical;
@@ -281,26 +281,26 @@ class Type_Base {
281 $sources = $this->data_sources; 281 $sources = $this->data_sources;
282 } 282 }
283 } 283 }
284 $this->parse_ds_names($sources); 284 $this->parse_legend($sources);
285 return $sources; 285 return $sources;
286 } 286 }
287 287
288 function parse_ds_names($sources) { 288 function parse_legend($sources) {
289 # fill ds_names if not defined by plugin 289 # fill legend if not defined by plugin
290 if (!is_array($this->ds_names)) 290 if (!is_array($this->legend))
291 $this->ds_names = array_combine($sources, $sources); 291 $this->legend = array_combine($sources, $sources);
292 292
293 # detect length of longest ds_name 293 # detect length of longest legend
294 $max = 0; 294 $max = 0;
295 foreach ($this->ds_names as $ds_name) { 295 foreach ($this->legend as $legend) {
296 if(strlen((string)$ds_name) > $max) 296 if(strlen((string)$legend) > $max)
297 $max = strlen((string)$ds_name); 297 $max = strlen((string)$legend);
298 } 298 }
299 299
300 # make all ds_names equal in lenght 300 # make all legend equal in lenght
301 $format = sprintf("%%-%ds", $max); 301 $format = sprintf("%%-%ds", $max);
302 foreach ($this->ds_names as $index => $value) { 302 foreach ($this->legend as $index => $value) {
303 $this->ds_names[$index] = sprintf($format, $value); 303 $this->legend[$index] = sprintf($format, $value);
304 } 304 }
305 } 305 }
306 306