Sample pie chart
Below is the source code that produces the above chart. /home/saito/pychart/demos/pietest.py
# # Copyright (C) 2000-2005 by Yasushi Saito (yasushi.saito@gmail.com) # # Pychart is free software; you can redistribute it and/or modify it # under the terms of the GNU General Public License as published by the # Free Software Foundation; either version 2, or (at your option) any # later version. # # Pychart is distributed in the hope that it will be useful, but WITHOUT # ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or # FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License # for more details. # from pychart import * import sys data = [("foo", 10),("bar", 20), ("baz", 30), ("ao", 40)] ar = area.T(size=(150,150), legend=legend.T(), x_grid_style = None, y_grid_style = None) plot = pie_plot.T(data=data, arc_offsets=[0,10,0,10], shadow = (2, -2, fill_style.gray50), label_offset = 25, arrow_style = arrow.a3) ar.add_plot(plot) ar.draw()
This class supports the following attributes:
You can draw each pie "slice" shifted off-center. This attribute, if non-None, must be a number sequence whose length is equal to the number of pie slices. The Nth value in arc_offsets specify the amount of offset (from the center of the circle) for the Nth slice. The value of None will draw all the slices anchored at the center.
The style of arrow that connects a label to the corresponding "pie".
The location of the center of the pie.
Specifies the data points. See Section 5
The column, within "data", from which the data values are retrieved.
The fill style of each item. The length of the list should be equal to the length of the data.
The column, within "data", from which the labels of items are retrieved.
The fill style of the frame surrounding each label.
Format string of the label
The style of the frame surrounding each label.
The distance from the center of each label.
The style of the outer edge of each pie slice.
The radius of the pie.
The value is either None or a tuple. When non-None, a drop-shadow is drawn beneath the object. X-off, and y-off specifies the offset of the shadow relative to the object, and fill specifies the style of the shadow ( see Section 16).
The angle at which the first item is drawn.