Web   ·   Wiki   ·   Activities   ·   Blog   ·   Lists   ·   Chat   ·   Meeting   ·   Bugs   ·   Git   ·   Translate   ·   Archive   ·   People   ·   Donate
summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorAgustin Zubiaga <aguz@sugarlabs.org>2012-07-14 01:41:10 (GMT)
committer Agustin Zubiaga <aguz@sugarlabs.org>2012-07-14 01:41:10 (GMT)
commit795a69b19ffa007e0247b6b5a11c047012e72937 (patch)
tree67658307b4121fb22ca6b9d15221532f939a1816
parent54bccb64bea10e9d0fe0ad32ab50aaf07aa258a5 (diff)
More beautiful charts :)
-rw-r--r--charts.py10
-rw-r--r--sugarpycha/chart.py7
2 files changed, 12 insertions, 5 deletions
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()