From 795a69b19ffa007e0247b6b5a11c047012e72937 Mon Sep 17 00:00:00 2001 From: Agustin Zubiaga Date: Sat, 14 Jul 2012 01:41:10 +0000 Subject: More beautiful charts :) --- diff --git a/charts.py b/charts.py index ae9258c..2cc0208 100644 --- a/charts.py +++ b/charts.py @@ -53,6 +53,7 @@ class Chart(gobject.GObject): 'axis': { 'tickFontSize': 12, 'labelFontSize': 14, + 'lineColor': '#b3b3b3', 'x': { 'ticks': [dict(v=i, label=l[0]) for i, l in enumerate(data)], @@ -63,9 +64,12 @@ class Chart(gobject.GObject): 'label': 'Y', } }, + 'stroke': { + 'width': 3 + }, 'background': { 'chartColor': '#FFFFFF', - 'lineColor': '#d1e5ec' + 'lineColor': '#CCCCCC' }, 'colorScheme': { 'name': 'gradient', @@ -79,9 +83,9 @@ class Chart(gobject.GObject): """Set the chart color scheme""" self.options["colorScheme"]["args"] = {'initialColor': color} - def set_line_color(self, color='#d1e5ec'): + def set_line_color(self, color='#000000'): """Set the chart line color""" - self.options["background"]["lineColor"] = color + self.options["stroke"]["color"] = color def set_x_label(self, text="X"): """Set the X Label""" diff --git a/sugarpycha/chart.py b/sugarpycha/chart.py index 2d75507..2ce6e05 100644 --- a/sugarpycha/chart.py +++ b/sugarpycha/chart.py @@ -365,7 +365,7 @@ class Chart(object): cx.line_to(x2, y2) cx.close_path() cx.stroke() - + cx.set_source_rgb(*hex2rgb('#000000')) cx.select_font_face(self.options.axis.tickFont, cairo.FONT_SLANT_NORMAL, cairo.FONT_WEIGHT_NORMAL) @@ -384,6 +384,7 @@ class Chart(object): y = -height / 2.0 cx.move_to(x - xb, y - yb) cx.show_text(label) + cx.set_source_rgb(*hex2rgb(self.options.axis.lineColor)) if self.debug: cx.rectangle(x, y, width, height) cx.stroke() @@ -393,6 +394,7 @@ class Chart(object): y -= height / 2.0 cx.move_to(x - xb, y - yb) cx.show_text(label) + cx.set_source_rgb(*hex2rgb(self.options.axis.lineColor)) if self.debug: cx.rectangle(x, y, width, height) cx.stroke() @@ -493,7 +495,6 @@ class Chart(object): return cx.save() - cx.set_source_rgb(*hex2rgb(self.options.axis.lineColor)) cx.set_line_width(self.options.axis.lineWidth) if not self.options.axis.y.hide: @@ -504,6 +505,7 @@ class Chart(object): if self.options.axis.y.label: self._renderYAxisLabel(cx, self.options.axis.y.label) + cx.set_source_rgb(*hex2rgb(self.options.axis.lineColor)) self._renderYAxis(cx) if not self.options.axis.x.hide: @@ -514,6 +516,7 @@ class Chart(object): if self.options.axis.x.label: self._renderXAxisLabel(cx, self.options.axis.x.label) + cx.set_source_rgb(*hex2rgb(self.options.axis.lineColor)) self._renderXAxis(cx) cx.restore() -- cgit v0.9.1