Legend:
- Unmodified
- Added
- Removed
-
trunk/src/chart.py
r93 r96 267 267 h += self.options.padding.top + self.options.padding.bottom 268 268 cx.rectangle(x, y, w, h) 269 cx.fill() 269 cx.fill() 270 270 271 271 if self.options.background.chartColor: 272 272 cx.set_source_rgb(*hex2rgb(self.options.background.chartColor)) 273 273 cx.rectangle(self.area.x, self.area.y, self.area.w, self.area.h) 274 cx.fill() 274 cx.fill() 275 275 276 276 if self.options.background.lineColor: 277 277 cx.set_source_rgb(*hex2rgb(self.options.background.lineColor)) 278 278 cx.set_line_width(self.options.axis.lineWidth) 279 self._renderLines(cx) 279 self._renderLines(cx) 280 280 281 281 cx.restore() … … 410 410 else: 411 411 cx.move_to(x - labelWidth / 2.0, y + fontAscent) 412 412 413 413 cx.show_text(label) 414 414 … … 471 471 def _renderTitle(self, cx): 472 472 if self.options.title: 473 cx.save() 473 cx.save() 474 474 cx.select_font_face(self.options.titleFont, 475 475 cairo.FONT_SLANT_NORMAL, 476 476 cairo.FONT_WEIGHT_BOLD) 477 cx.set_font_size(self.options.titleFontSize) 477 cx.set_font_size(self.options.titleFontSize) 478 478 479 479 title = unicode(self.options.title) 480 480 extents = cx.text_extents(title) 481 titleWidth = extents[2] 482 483 x = self.area.x + self.area.w / 2.0 - titleWidth / 2.0 484 y = cx.font_extents()[0] # font ascent 481 titleWidth = extents[2] 482 483 x = self.area.x + self.area.w / 2.0 - titleWidth / 2.0 484 y = cx.font_extents()[0] # font ascent 485 485 486 486 cx.move_to(x, y) 487 487 cx.show_text(title) 488 488 489 489 cx.restore() 490 490 -
trunk/src/color.py
r85 r96 25 25 return maxValue 26 26 return value 27 27 28 28 def hex2rgb(hexstring, digits=2): 29 29 """Converts a hexstring color to a rgb tuple. … … 48 48 clamp(0.0, 1.0, g + amount), 49 49 clamp(0.0, 1.0, b + amount)) 50 50 51 51 def generateColorscheme(masterColor, keys): 52 52 """Generates a dictionary where the keys match the keys argument and -
trunk/src/line.py
r85 r96 20 20 21 21 class LineChart(Chart): 22 22 23 23 def __init__(self, surface=None, options={}): 24 24 super(LineChart, self).__init__(surface, options) 25 25 self.points = [] 26 26 27 27 def _updateChart(self): 28 28 """Evaluates measures for line charts""" … … 35 35 y = 1.0 - (yval - self.minyval) * self.yscale 36 36 point = Point(x, y, xval, yval, name) 37 37 38 38 if 0.0 <= point.x <= 1.0 and 0.0 <= point.y <= 1.0: 39 39 self.points.append(point) 40 40 41 41 def _renderChart(self, cx): 42 """Renders a line chart""" 42 """Renders a line chart""" 43 43 def preparePath(storeName): 44 44 cx.new_path() … … 72 72 cx.set_source_rgb(*self.options.colorScheme[storeName]) 73 73 cx.stroke() 74 74 75 75 76 76 cx.save() … … 86 86 cx.fill() 87 87 cx.restore() 88 88 89 89 # fill the line 90 90 cx.set_source_rgb(*self.options.colorScheme[storeName]) 91 91 preparePath(storeName) 92 92 cx.fill() 93 93 94 94 if not self.options.stroke.hide: 95 95 # draw stroke -
trunk/src/pie.py
r85 r96 78 78 if self.options.background.hide: 79 79 return 80 80 81 81 cx.save() 82 82 … … 88 88 cx.rectangle(x, y, w, h) 89 89 cx.fill() 90 90 91 91 cx.restore() 92 92 … … 187 187 cx.line_to(centerx, centery) 188 188 cx.close_path() 189 189 190 190 def getNormalisedAngle(self): 191 191 normalisedAngle = (self.startAngle + self.endAngle) / 2 -
trunk/src/scatter.py
r85 r96 21 21 22 22 class ScatterplotChart(LineChart): 23 23 24 24 def _renderChart(self, cx): 25 25 """Renders a scatterplot""" … … 31 31 cx.move_to(ox , oy-size) 32 32 cx.line_to(ox , oy+size) 33 33 34 34 def preparePath(storeName, size=2): 35 35 cx.new_path() … … 38 38 drawSymbol(point, size) 39 39 cx.close_path() 40 40 41 41 cx.save() 42 42 43 43 cx.set_line_width(self.options.stroke.width) 44 44 # TODO: self.options.stroke.shadow … … 47 47 preparePath(key) 48 48 cx.stroke() 49 49 50 50 cx.restore() 51 51
