Web   ·   Wiki   ·   Activities   ·   Blog   ·   Lists   ·   Chat   ·   Meeting   ·   Bugs   ·   Git   ·   Translate   ·   Archive   ·   People   ·   Donate
summaryrefslogtreecommitdiffstats
path: root/charts.py
diff options
context:
space:
mode:
authorAgustin Zubiaga <aguz@sugarlabs.org>2012-02-22 19:39:00 (GMT)
committer Agustin Zubiaga <aguz@sugarlabs.org>2012-02-22 19:39:00 (GMT)
commit93dc7d0829ce18b9a15710ce0fb7ba25fcc4158c (patch)
tree5f611f82cf92006170384b4e457d01cbcfc5de73 /charts.py
parent35deb2d4439637f55425f467bc75a48933a36d9a (diff)
Docstrings in charts.py
Diffstat (limited to 'charts.py')
-rw-r--r--charts.py12
1 files changed, 11 insertions, 1 deletions
diff --git a/charts.py b/charts.py
index 84ea549..25f21a4 100644
--- a/charts.py
+++ b/charts.py
@@ -46,6 +46,8 @@ class Chart(gobject.GObject):
self.height = height
def data_set(self, data):
+ '''Set chart data (dataSet)'''
+
self.dataSet = (
('Puntos', [(i, l[1]) for i, l in enumerate(data)]),
)
@@ -76,24 +78,32 @@ class Chart(gobject.GObject):
}
def set_color_scheme(self, color='blue'):
+ '''Set the chart color scheme'''
self.options["colorScheme"]["args"] = {'initialColor': color}
def set_line_color(self, color='#d1e5ec'):
+ '''Set the chart line color'''
self.options["background"]["lineColor"] = color
def set_x_label(self, text="X"):
+ '''Set the X Label'''
self.options["axis"]["x"]["label"] = str(text)
def set_y_label(self, text="Y"):
+ '''Set the Y Label'''
self.options["axis"]["y"]["label"] = str(text)
def set_type(self, type="vertical"):
+ '''Set chart type (vertical, horizontal, line, pie)'''
self.type = type
def set_title(self, title="SimpleGraph Chart"):
+ '''Set the chart title'''
self.options["title"] = title
def render(self, sg=None):
+ '''Draw the chart
+ Use the self.surface variable for show the chart'''
self.surface = cairo.ImageSurface(cairo.FORMAT_ARGB32,
self.width,
self.height)
@@ -118,6 +128,6 @@ class Chart(gobject.GObject):
chart.render()
def as_png(self):
- # FIXME, don't use a temporal file
+ '''Save the chart as png image'''
self.surface.write_to_png(CHART_IMAGE)
return CHART_IMAGE