Changeset 81 for trunk/src/chart.py

Show
Ignore:
Timestamp:
03/21/08 13:32:34 (4 years ago)
Author:
lgs
Message:

Support for drawing the whole background in a solid color. Patch by jae. See #6

Files:
1 modified

Legend:

Unmodified
Added
Removed
  • trunk/src/chart.py

    r80 r81  
    258258 
    259259        cx.save() 
    260         cx.set_source_rgb(*hex2rgb(self.options.background.color)) 
    261         cx.rectangle(self.area.x, self.area.y, self.area.w, self.area.h) 
    262         cx.fill() 
    263         cx.set_source_rgb(*hex2rgb(self.options.background.lineColor)) 
    264         cx.set_line_width(self.options.axis.lineWidth) 
    265  
    266         self._renderLines(cx) 
     260 
     261        if self.options.background.baseColor: 
     262            cx.set_source_rgb(*hex2rgb(self.options.background.baseColor)) 
     263            x, y, w, h = 0, 0, self.area.w, self.area.h 
     264            w += self.options.padding.left + self.options.padding.right 
     265            h += self.options.padding.top + self.options.padding.bottom 
     266            cx.rectangle(x, y, w, h) 
     267            cx.fill()  
     268 
     269        if self.options.background.chartColor: 
     270            cx.set_source_rgb(*hex2rgb(self.options.background.chartColor)) 
     271            cx.rectangle(self.area.x, self.area.y, self.area.w, self.area.h) 
     272            cx.fill()  
     273 
     274        if self.options.background.lineColor: 
     275            cx.set_source_rgb(*hex2rgb(self.options.background.lineColor)) 
     276            cx.set_line_width(self.options.axis.lineWidth) 
     277            self._renderLines(cx)  
    267278 
    268279        cx.restore() 
     
    493504    ), 
    494505    background=Option( 
    495         color='#f5f5f5', 
    496506        hide=False, 
     507        baseColor=None, 
     508        chartColor='#f5f5f5', 
    497509        lineColor='#ffffff', 
    498510        lineWidth=1.5,