Changeset 109 for trunk/src/line.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/line.py

    r97 r109  
    1717 
    1818from pycha.chart import Chart 
    19 from pycha.color import hex2rgb, clamp 
     19from pycha.color import hex2rgb 
    2020 
    2121class LineChart(Chart): 
     
    4747            if self.options.shouldFill: 
    4848                # Go to the (0,0) coordinate to start drawing the area 
    49                 cx.move_to(self.area.x, self.area.y + self.area.h) 
     49                #cx.move_to(self.area.x, self.area.y + self.area.h) 
     50                cx.move_to(self.area.x, 
     51                           self.area.y + (1.0 - self.area.origin) * self.area.h) 
    5052 
    5153            for point in self.points: 
     
    6567            if self.options.shouldFill: 
    6668                # Close the path to the start point 
    67                 cx.line_to(lastX * self.area.w + self.area.x, 
    68                            self.area.h + self.area.y) 
    69                 cx.line_to(self.area.x, self.area.y + self.area.h) 
     69                y = (1.0 - self.area.origin) * self.area.h + self.area.y 
     70                cx.line_to(lastX * self.area.w + self.area.x, y) 
     71                cx.line_to(self.area.x, y) 
    7072                cx.close_path() 
    7173            else: