Ticket #25: stroke-shadow.patch

File stroke-shadow.patch, 1.1 kB (added by aprzywecki@…, 3 years ago)

draws a real shadow and fixes stroke = hide

  • pycha/bar.py

     
    8585 
    8686                if self.options.shouldFill: 
    8787                    cx.set_source_rgb(*self.options.colorScheme[bar.name]) 
    88                     cx.fill_preserve() 
     88                    cx.fill() 
    8989 
    9090                if not self.options.stroke.hide: 
     91                    cx.rectangle(x, y, w, h) 
    9192                    cx.set_source_rgb(*hex2rgb(self.options.stroke.color)) 
    9293                    cx.stroke() 
    9394 
     
    124125        self.xticks = [(tick[0] + offset, tick[1]) for tick in self.xticks] 
    125126 
    126127    def _getShadowRectangle(self, x, y, w, h): 
    127         return (x-2, y-2, w+4, h+2) 
     128        return ((x+(w/5.0)), y-(w/10.0)), w, (h+(w/10.0))) 
    128129 
    129130 
    130131class HorizontalBarChart(BarChart): 
     
    164165            self._renderLine(cx, tick, True) 
    165166 
    166167    def _getShadowRectangle(self, x, y, w, h): 
    167         return (x, y-2, w+2, h+4) 
     168        return (x, (y+(h/5.0)), (w+(h/10.0)), h) 
    168169 
    169170    def _renderXAxis(self, cx): 
    170171        """Draws the horizontal line representing the X axis"""