Changeset 109 for trunk/src/pie.py

Show
Ignore:
Timestamp:
10/27/08 16:49:58 (4 years ago)
Author:
lgs
Message:

Some refactoring and support for negative values in line and bar charts. Inspired by Nicolas patch

Files:
1 modified

Legend:

Unmodified
Added
Removed
  • trunk/src/pie.py

    r102 r109  
    6060        self.xticks = [] 
    6161        if self.options.axis.x.ticks: 
    62             lookup = dict([(slice.xval, slice) for slice in self.slices]) 
     62#            lookup = dict([(slice.xval, slice) for slice in self.slices]) 
     63            lookup = dict([(slice.name, slice) for slice in self.slices]) 
    6364            for tick in self.options.axis.x.ticks: 
    6465                if not isinstance(tick, Option): 
     
    7172        else: 
    7273            for slice in self.slices: 
    73                 label = '%s (%.1f%%)' % (slice.xval, slice.fraction * 100) 
    74                 self.xticks.append((slice.xval, label)) 
     74#                label = '%s (%.1f%%)' % (slice.xval, slice.fraction * 100) 
     75#                self.xticks.append((slice.xval, label)) 
     76                label = '%s (%.1f%%)' % (slice.name, slice.fraction * 100) 
     77                self.xticks.append((slice.name, label)) 
    7578 
    7679    def _renderBackground(self, cx): 
     
    130133 
    131134        self.xlabels = [] 
    132         lookup = dict([(slice.xval, slice) for slice in self.slices]) 
     135#        lookup = dict([(slice.xval, slice) for slice in self.slices]) 
     136        lookup = dict([(slice.name, slice) for slice in self.slices]) 
    133137 
    134138        cx.set_source_rgb(*hex2rgb(self.options.axis.labelColor))