43
43
"maroon" : (0.5,0.0,0.0,1.0), "green" : (0.0,0.5,0.0,1.0), "navy" : (0.0,0.0,0.5,1.0),
44
44
"yellow" : (1.0,1.0,0.0,1.0), "magenta" : (1.0,0.0,1.0,1.0), "cyan" : (0.0,1.0,1.0,1.0),
45
45
"orange" : (1.0,0.5,0.0,1.0), "white" : (1.0,1.0,1.0,1.0), "black" : (0.0,0.0,0.0,1.0),
46
"gray" : (0.5,0.5,0.5,1.0), "light_gray" : (0.9,0.9,0.9,1.0),
46
47
"transparent" : (0.0,0.0,0.0,0.0)}
48
49
THEMES = {"black_red" : [(0.0,0.0,0.0,1.0), (1.0,0.0,0.0,1.0)],
215
216
def set_background(self, background):
216
217
if background is None:
217
self.background = cairo.LinearGradient(self.dimensions[HORZ] / 2, 0, self.dimensions[HORZ] / 2, self.dimensions[VERT])
218
self.background.add_color_stop_rgba(0,1.0,1.0,1.0,1.0)
219
self.background.add_color_stop_rgba(1.0,0.9,0.9,0.9,1.0)
220
elif not hasattr(background,"__iter__") and background.lower() in COLORS:
221
self.background = COLORS[background]
218
self.background = (0.0,0.0,0.0,0.0)
219
elif type(background) in (cairo.LinearGradient, tuple):
220
self.background = background
221
elif not hasattr(background,"__iter__"):
222
colors = background.split(" ")
223
if len(colors) == 1 and colors[0] in COLORS:
224
self.background = COLORS[background]
225
elif len(colors) > 1:
226
self.background = cairo.LinearGradient(self.dimensions[HORZ] / 2, 0, self.dimensions[HORZ] / 2, self.dimensions[VERT])
227
for index,color in enumerate(colors):
228
self.background.add_color_stop_rgba(float(index)/(len(colors)-1),*COLORS[color])
223
if type(background) in (cairo.LinearGradient, tuple):
224
self.background = background
226
raise TypeError ("Background should be either cairo.LinearGradient or a 3-tuple, not %s" % type(background))
230
raise TypeError ("Background should be either cairo.LinearGradient or a 3-tuple, not %s" % type(background))
228
232
def render_background(self):
229
233
if isinstance(self.background, cairo.LinearGradient):
1653
1657
- Function to plot graphics using dots and lines.
1655
dot_line_plot (name, data, width, height, background = None, border = 0, axis = False, grid = False, x_labels = None, y_labels = None, x_bounds = None, y_bounds = None)
1659
dot_line_plot (name, data, width, height, background = "white light_gray", border = 0, axis = False, grid = False, x_labels = None, y_labels = None, x_bounds = None, y_bounds = None)
1712
1716
- Function to plot functions.
1714
function_plot(name, data, width, height, background = None, border = 0, axis = True, grid = False, dots = False, x_labels = None, y_labels = None, x_bounds = None, y_bounds = None, step = 1, discrete = False)
1718
function_plot(name, data, width, height, background = "white light_gray", border = 0, axis = True, grid = False, dots = False, x_labels = None, y_labels = None, x_bounds = None, y_bounds = None, step = 1, discrete = False)
1744
def pie_plot( name, data, width, height, background = None, gradient = False, shadow = False, colors = None ):
1748
def pie_plot( name, data, width, height, background = "white light_gray", gradient = False, shadow = False, colors = None ):
1747
1751
- Function to plot pie graphics.
1749
pie_plot(name, data, width, height, background = None, gradient = False, colors = None)
1753
pie_plot(name, data, width, height, background = "white light_gray", gradient = False, colors = None)
1772
def donut_plot(name, data, width, height, background = None, gradient = False, shadow = False, colors = None, inner_radius = -1):
1776
def donut_plot(name, data, width, height, background = "white light_gray", gradient = False, shadow = False, colors = None, inner_radius = -1):
1775
1779
- Function to plot donut graphics.
1777
donut_plot(name, data, width, height, background = None, gradient = False, inner_radius = -1)
1781
donut_plot(name, data, width, height, background = "white light_gray", gradient = False, inner_radius = -1)