def drawLegend(self, cr, widht, height): super(Line, self).drawLegend(cr, widht, height) cr.save() for point in self.points: if point.highlight: cr.set_line_width(2) cr.set_source_rgb(*common.hex2rgb('#000000')) cr.move_to(point.x * self.area.w + self.area.x, point.y * self.area.h + self.area.y) cr.arc(point.x * self.area.w + self.area.x, point.y * self.area.h + self.area.y, 3, 0, 2 * math.pi) cr.stroke() cr.set_source_rgb(*common.highlight_rgb( *self.colorScheme[point.yname])) cr.arc(point.x * self.area.w + self.area.x, point.y * self.area.h + self.area.y, 3, 0, 2 * math.pi) cr.fill() cr.restore()
def drawBar(bar): cr.set_line_width(0.5) x = self.area.w * bar.x + self.area.x y = self.area.h * bar.y + self.area.y w = self.area.w * bar.w h = self.area.h * bar.h if w < 1 or h < 1: return # don't draw too small self.drawRectangle(cr, x, y, w, h) r, g, b = self.colorScheme[bar.yname] if bar.highlight: r, g, b = common.highlight_rgb(r, g, b) cr.set_source(self.sourceRectangle(x, y, w, h, r, g, b)) cr.fill_preserve() cr.stroke()
def drawGraph(self, cr, width, height): cr.set_line_join(cairo.LINE_JOIN_ROUND) cr.save() for slice in self.slices: if slice.isBigEnough(): if bool(int(self.yfields[0].get('fill', 1))): color = self.colorScheme[slice.xname] if slice.highlight: color = common.highlight_rgb(*color) cr.set_source_rgba(*color) slice.draw(cr, self.centerx, self.centery, self.radius) cr.fill() cr.set_source_rgb( *common.hex2rgb(self.attrs.get('background', '#f5f5f5'))) slice.draw(cr, self.centerx, self.centery, self.radius) cr.set_line_width(2) cr.stroke() cr.restore()
def drawGraph(self, cr, width, height): cr.set_line_join(cairo.LINE_JOIN_ROUND) cr.save() for slice in self.slices: if slice.isBigEnough(): if bool(int(self.yfields[0].get('fill', 1))): color = self.colorScheme[slice.xname] if slice.highlight: color = common.highlight_rgb(*color) cr.set_source_rgba(*color) slice.draw(cr, self.centerx, self.centery, self.radius) cr.fill() cr.set_source_rgb(*common.hex2rgb( self.attrs.get('background', '#f5f5f5'))) slice.draw(cr, self.centerx, self.centery, self.radius) cr.set_line_width(2) cr.stroke() cr.restore()