Changeset 1765

Show
Ignore:
Timestamp:
12/03/08 18:45:10 (1 month ago)
Author:
jlmartinez
Message:

/rrdgraph

Change ordering implementation. Makes future user-specified ordering easier, and non-ordered items sort naturally (as their value in %stacked is undef (== 0 in comparison).

Files:

Legend:

Unmodified
Added
Removed
Modified
Copied
Moved
  • branches/DEV-capside/opsview-web/lib/Opsview/Web/Controller/RRDgraph.pm

    r1764 r1765  
    8181 
    8282        my %metrics = map { ($_ => 1) } @$metrics; 
    83         my $pos = 1; 
    84         my %stacked = map { ($_ => $pos++) } @$stacked; 
     83        my $pos = -1; 
     84        my %stacked = map { ($_ => $pos--) } reverse @$stacked; 
    8585 
    8686        # Get list of all files in directory 
     
    186186         
    187187        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)) 
     188                                        return(($stacked{ $a }) <=> ($stacked{ $b })) 
    191189                                    } else {  
    192190                                        return($a cmp $b);