Changeset 1764
- Timestamp:
- 12/03/08 18:31:31 (1 month ago)
- Files:
Legend:
- Unmodified
- Added
- Removed
- Modified
- Copied
- Moved
branches/DEV-capside/opsview-web/lib/Opsview/Web/Controller/RRDgraph.pm
r1763 r1764 65 65 my $title = $params->{'title'}; 66 66 my $stacked = $params->{stack} || 0; 67 my $type = "LINE1"; 68 if ($stacked) { 69 $stacked = ":STACK"; 70 $type = "AREA"; 71 } else { 72 $stacked = ""; 67 my $all_stacked = 0; 68 if ($stacked eq '1') { 69 $all_stacked = ":STACK"; 73 70 } 74 71 … … 80 77 my $services = convert_to_arrayref($params->{service}); 81 78 my $metrics = convert_to_arrayref($params->{metric}); 79 $stacked = convert_to_arrayref($params->{stack}); 80 my $order = convert_to_arrayref($params->{order}); 81 82 82 my %metrics = map { ($_ => 1) } @$metrics; 83 my $pos = 1; 84 my %stacked = map { ($_ => $pos++) } @$stacked; 83 85 84 86 # Get list of all files in directory … … 149 151 push @$rrdoptions, "--title", $title; 150 152 } 151 foreach my $dsname ( sortkeys %$ds) {153 foreach my $dsname (keys %$ds) { 152 154 foreach my $hash (@{ $ds->{$dsname} }) { 153 155 # $vname is a unique datapoint name, stripped of invalid characters … … 183 185 } 184 186 185 foreach my $dsname (sort keys %$ds) { 187 foreach my $dsname (sort { if($stacked{ $a } or $stacked{ $b }){ 188 # if the column isn't stacked it has a very low priority (all 189 # stacked columns get rendered before unstacked ones) 190 return(($stacked{ $a } || 1000) <=> ($stacked{ $b } || 1000)) 191 } else { 192 return($a cmp $b); 193 } 194 } keys %$ds) { 186 195 foreach my $hash (@{ $ds->{$dsname} }) { 187 196 my $f = $hash->{file}; … … 190 199 my $nextcolour = shift @colours; 191 200 my $fixedw_legend = $hash->{'legend'} . (' ' x ($max_legend_length - length($hash->{'legend'}))); 201 my $stacked = (($all_stacked) or ($stacked{ $dsname }))?':STACK':''; 202 my $type = ($stacked eq '')?'LINE1':'AREA'; 192 203 push @$rrdoptions, 193 204 "DEF:$vname=$f:$dsname:AVERAGE",
