Remove the write_at function. Use draw_text instead. Add center_text to SVGDoc
svn: r8089
This commit is contained in:
@ -903,7 +903,7 @@ def draw_pie_chart(doc, center_x, center_y, radius, data, start=0):
|
||||
doc.draw_wedge(item[0], center_x, center_y, radius, start, start + incr)
|
||||
start += incr
|
||||
|
||||
def draw_legend(doc, start_x, start_y, data, title=None):
|
||||
def draw_legend(doc, start_x, start_y, data, title, label_style):
|
||||
"""
|
||||
Draws a legend for a graph in the specified document. The data passed is
|
||||
used to define the legend. First item style is used for the optional
|
||||
@ -923,16 +923,19 @@ def draw_legend(doc, start_x, start_y, data, title=None):
|
||||
legend_description).
|
||||
@type data: list
|
||||
"""
|
||||
if title:
|
||||
gstyle = doc.get_draw_style(label_style)
|
||||
pstyle = gstyle.get_paragraph_style()
|
||||
size = pt2cm(doc.get_style(pstyle).get_font().get_size())
|
||||
doc.draw_text(label_style, title, start_x + (3*size), start_y - (size*0.25))
|
||||
start_y += size * 1.3
|
||||
|
||||
for (format, size, legend) in data:
|
||||
gstyle = doc.get_draw_style(format)
|
||||
pstyle = gstyle.get_paragraph_style()
|
||||
size = pt2cm(doc.get_style(pstyle).get_font().get_size())
|
||||
if title:
|
||||
doc.write_at(pstyle, title, start_x + (3*size), start_y - (size*0.25))
|
||||
start_y += size * 1.3
|
||||
title = None
|
||||
doc.draw_bar(format, start_x, start_y, start_x + (2*size), start_y + size)
|
||||
doc.write_at(pstyle, legend, start_x + (3*size), start_y - (size*0.25))
|
||||
doc.draw_text(label_style, legend, start_x + (3*size), start_y - (size*0.25))
|
||||
start_y += size * 1.3
|
||||
|
||||
def draw_vertical_bar_graph(doc, format, start_x, start_y, height, width, data):
|
||||
|
Reference in New Issue
Block a user