From 75a1e8a552a1e0f4d0948489737c93827ca4a8b5 Mon Sep 17 00:00:00 2001 From: Pim van den Berg Date: Sat, 3 May 2014 19:06:10 +0200 Subject: type/base: show tinstances not defined in $this->order in graph Previously if $this->order was defined in a graph, only type instances that were defined in $this->order showed up in the graph. Now it merges $this->order and the type instances. --- type/Base.class.php | 11 +++++------ 1 file changed, 5 insertions(+), 6 deletions(-) (limited to 'type') diff --git a/type/Base.class.php b/type/Base.class.php index 7c06e5d..9ceee4e 100644 --- a/type/Base.class.php +++ b/type/Base.class.php @@ -11,8 +11,8 @@ class Type_Base { var $seconds; var $data_sources = array('value'); var $order; - var $legend; - var $colors; + var $legend = array(); + var $colors var $rrd_title; var $rrd_vertical; var $rrd_format = '%5.1lf%s'; @@ -256,7 +256,7 @@ class Type_Base { if (is_array($this->files) && count($this->files)>1) { # and must it be ordered? if (is_array($this->order)) { - $this->tinstances = array_merge(array_intersect($this->order, $this->tinstances)); + $this->tinstances = array_merge(array_unique(array_merge(array_intersect($this->order, $this->tinstances), $this->tinstances))); } # use tinstances as sources if(is_array($this->data_sources) && count($this->data_sources)>1) { @@ -286,9 +286,8 @@ class Type_Base { } function parse_legend($sources) { - # fill legend if not defined by plugin - if (!is_array($this->legend)) - $this->legend = array_combine($sources, $sources); + # fill up legend by items that are not defined by plugin + $this->legend = array_merge(array_combine($sources, $sources), $this->legend); # detect length of longest legend $max = 0; -- cgit v1.1