本文整理汇总了Python中reportlab.graphics.charts.piecharts.Pie.height方法的典型用法代码示例。如果您正苦于以下问题:Python Pie.height方法的具体用法?Python Pie.height怎么用?Python Pie.height使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类reportlab.graphics.charts.piecharts.Pie
的用法示例。
在下文中一共展示了Pie.height方法的15个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的Python代码示例。
示例1: draw_time_repartition
# 需要导入模块: from reportlab.graphics.charts.piecharts import Pie [as 别名]
# 或者: from reportlab.graphics.charts.piecharts.Pie import height [as 别名]
def draw_time_repartition(mandate):
drawing = Drawing(width=180*mm, height=120*mm)
pdf_chart_colors = [HexColor("#fa9d00"), HexColor("#006884"), HexColor("#00909e"), HexColor("#ffd08d"), ]
pie = Pie()
pie.x = 60*mm
pie.y = 35*mm
pie.width = 60*mm
pie.height = 60*mm
pie.slices.strokeWidth = 0.5
pie.slices.fontName = 'Helvetica'
pie.slices.fontSize = 8
pie.data = []
pie.labels = []
titles = []
add_data_and_titles_to_pie(pie, titles, mandate.research_percent, 'research_percent')
add_data_and_titles_to_pie(pie, titles, mandate.tutoring_percent, 'tutoring_percent')
add_data_and_titles_to_pie(pie, titles, mandate.service_activities_percent, 'service_activities_percent')
add_data_and_titles_to_pie(pie, titles, mandate.formation_activities_percent, 'formation_activities_percent')
if len(pie.data) > 0:
drawing.add(pie)
add_legend_to_pie(drawing)
n = len(pie.data)
set_items(n, pie.slices, 'fillColor', pdf_chart_colors)
drawing.legend.colorNamePairs = \
[(pie.slices[i].fillColor, (titles[i], '%0.f' % pie.data[i] + '%')) for i in range(n)]
return drawing
示例2: __init__
# 需要导入模块: from reportlab.graphics.charts.piecharts import Pie [as 别名]
# 或者: from reportlab.graphics.charts.piecharts.Pie import height [as 别名]
def __init__(self, width, height, labels, data):
IRender.__init__(self, width, height, labels, data)
#self.w = self.width
#self.h = self.height
#data = {}
#for value in self.data:
# data[value[0]] = int(value[1])
#plot = cairoplot.PiePlot('/tmp/tmp.png', data, self.w*2, self.h*2, gradient=True)
##plot.font_size *= 2
#plot.render()
#plot.commit()
#with open('/tmp/tmp.png') as f:
# self.image = Image(StringIO(f.read()), self.w, self.h)
pc = Pie()
pc.width = min(self.height,self.width - 150)
pc.height = min(self.height - 50,self.width)
pc.width = pc.height = min(pc.height, pc.width)
pc.x = self.width / 2 - pc.width / 2
pc.y = self.height / 2 - pc.height / 2
pc.data = [int(line[1]) for line in self.data]
pc.labels = [line[0] for line in self.data]
for i in xrange(len(self.data)):
pc.slices[i].fillColor = COLORS[i % len(COLORS)]
pc.slices[i].strokeColor = COLORS[i % len(COLORS)]
self.drawing = Drawing(self.width, self.height)
self.drawing.add(pc)
示例3: __add_graph
# 需要导入模块: from reportlab.graphics.charts.piecharts import Pie [as 别名]
# 或者: from reportlab.graphics.charts.piecharts.Pie import height [as 别名]
def __add_graph(self):
drawing = Drawing(200, 100)
data = list()
labels = list()
self.c.drawString(370, 730,
'Distribucion en pesos'.encode('utf-8'))
for acc in self.accounts:
balance = acc.balance
if acc.currency == 'USD':
balance = balance * self.dolar
data.append(balance)
labels.append(acc.name)
pie = Pie()
pie.x = 280
pie.y = 630
pie.height = 100
pie.width = 100
pie.data = data
pie.labels = labels
pie.simpleLabels = 1
pie.slices.strokeWidth = 1
pie.slices.strokeColor = black
pie.slices.label_visible = 0
legend = Legend()
legend.x = 400
legend.y = 680
legend.dx = 8
legend.dy = 8
legend.fontName = 'Helvetica'
legend.fontSize = 7
legend.boxAnchor = 'w'
legend.columnMaximum = 10
legend.strokeWidth = 1
legend.strokeColor = black
legend.deltax = 75
legend.deltay = 10
legend.autoXPadding = 5
legend.yGap = 0
legend.dxTextSpace = 5
legend.alignment = 'right'
legend.dividerLines = 1|2|4
legend.dividerOffsY = 4.5
legend.subCols.rpad = 30
n = len(pie.data)
self.__setItems(n,pie.slices,
'fillColor',self.pdf_chart_colors)
legend.colorNamePairs = [(pie.slices[i].fillColor,
(pie.labels[i][0:20],'$%0.2f' % pie.data[i])) for i in xrange(n)]
drawing.add(pie)
drawing.add(legend)
x, y = 0, 0
renderPDF.draw(drawing, self.c, x, y, showBoundary=False)
示例4: test_24_PieCharts
# 需要导入模块: from reportlab.graphics.charts.piecharts import Pie [as 别名]
# 或者: from reportlab.graphics.charts.piecharts.Pie import height [as 别名]
def test_24_PieCharts(self):
from reportlab.lib.styles import getSampleStyleSheet
from reportlab.lib import colors
from reportlab.lib.units import inch
from reportlab.platypus import SimpleDocTemplate, Spacer, Paragraph
from reportlab.pdfbase import pdfmetrics
from reportlab.graphics.shapes import Drawing
from reportlab.pdfbase.ttfonts import TTFont
from reportlab.graphics.charts.piecharts import Pie
pdfmetrics.registerFont(TTFont('chsFont', 'STHeiti Light.ttc'))
stylesheet = getSampleStyleSheet()
elements = []
doc = SimpleDocTemplate("demo.pdf")
elements.append(Paragraph('<font name="chsFont">JY.zenist.song - 俊毅</font>', stylesheet['Title']))
elements.append(Spacer(1,1*inch))
d = Drawing(400,200)
data = [13,5,20,22,37,45]
pc = Pie()
pc.x = 65
pc.y = 15
pc.width = 150
pc.height = 150
pc.data = data
pc.labels = ['a','b','c','d','e','f']
d.add(pc)
elements.append(d)
doc.build(elements)
示例5: draw_Pie
# 需要导入模块: from reportlab.graphics.charts.piecharts import Pie [as 别名]
# 或者: from reportlab.graphics.charts.piecharts.Pie import height [as 别名]
def draw_Pie(story, ProjectID):
d = Drawing(140, 180)
pie = Pie()
pie.sideLabels = 1
pie.labels= get_story_name_list(ProjectID)
pie.data = get_story_count_list(ProjectID)
pie.width = 140
pie.height = 140
pie.y = 0
pie.x = 150
d.add(pie)
story.append(d)
示例6: graphout
# 需要导入模块: from reportlab.graphics.charts.piecharts import Pie [as 别名]
# 或者: from reportlab.graphics.charts.piecharts.Pie import height [as 别名]
def graphout(prod_catnames, data):
drawing = Drawing(500, 200)
pie = Pie()
pie.sideLabels = 1
pie.labels = prod_catnames
pie.data = data[0]
pie.width = 140
pie.height = 140
pie.y = 35
pie.x = 125
pie.slices.popout = 5
drawing.add(pie)
return drawing
示例7: __init__
# 需要导入模块: from reportlab.graphics.charts.piecharts import Pie [as 别名]
# 或者: from reportlab.graphics.charts.piecharts.Pie import height [as 别名]
def __init__(self, data, labels):
super(PieChart, self).__init__(400,200)
colors = [
HexColor("#0000e5"),
HexColor("#ff0011"),
HexColor("#800000"),
HexColor("#e05897"),
HexColor("#a08ff7"),
HexColor("#8f8ff5"),
HexColor("#c7c7fa"),
HexColor("#800000"),
HexColor("#eb8585"),
HexColor("#d60a0a"),
HexColor("#ffff00"),
HexColor("#1f1feb"),
]
# Create pie chart
pieChart = Pie()
pieChart.x = 40
pieChart.y = 30
pieChart.width = 120
pieChart.height = 120
pieChart.slices.strokeWidth=0.5
data = json.loads(data)
pieChart.data = data
pieChart.labels = []
labels = json.loads(labels.replace("'",'"'))
for d in data:
pieChart.labels.append(str(d))
# Create legend
legend = Legend()
legend.x = 380
legend.y = 60
legend.boxAnchor = 'se'
legend.subCols[1].align = 'right'
legend.colorNamePairs = []
len_data = len(data)
for i in range(0,len_data):
pieChart.slices[i].fillColor = colors[i]
legend.colorNamePairs.append((colors[i],labels[i]))
self.add(pieChart, "pie chart")
self.add(legend, "legend")
示例8: create_pie
# 需要导入模块: from reportlab.graphics.charts.piecharts import Pie [as 别名]
# 或者: from reportlab.graphics.charts.piecharts.Pie import height [as 别名]
def create_pie(pie_data):
pie_chart = Drawing(400, 200)
pc = Pie()
pc.x = 65
pc.y = 15
pc.width = 100
pc.height = 100
pc.data = pie_data["data"]
pc.labels = list(pie_data["label"][0])
pc.slices.strokeWidth=0.5
pc.slices[3].popout = 10
pc.slices[3].strokeWidth = 2
pc.slices[3].strokeDashArray = [2,2]
pc.slices[3].labelRadius = 1.75
pc.slices[3].fontColor = colors.red
pie_chart.add(pc)
return pie_chart
示例9: pie_graph
# 需要导入模块: from reportlab.graphics.charts.piecharts import Pie [as 别名]
# 或者: from reportlab.graphics.charts.piecharts.Pie import height [as 别名]
def pie_graph(data, elements):
drawing = Drawing(100, 350)
pc = Pie()
pc.x = 65
pc.y = 15
pc.width = 300
pc.height = 300
pc.data = data
pc.labels = ['a', 'b', 'c', 'd', 'e', 'f']
pc.slices.strokeWidth = 0.5
pc.slices[3].popout = 10
pc.slices[3].strokeWidth = 2
pc.slices[3].strokeDashArray = [2, 2]
pc.slices[3].labelRadius = 1.75
pc.slices[3].fontColor = colors.red
drawing.add(pc)
elements.append(drawing)
示例10: piegraph
# 需要导入模块: from reportlab.graphics.charts.piecharts import Pie [as 别名]
# 或者: from reportlab.graphics.charts.piecharts.Pie import height [as 别名]
def piegraph(elements):
drawing = Drawing(100, 350)
pc = Pie()
pc.x = 65
pc.y = 15
pc.width = 300
pc.height = 300
pc.data = [10, 20, 30, 40, 50, 60]
pc.labels = ['a', 'b', 'c', 'd', 'e', 'f']
pc.slices.strokeWidth = 0.5
pc.slices[3].popout = 10
pc.slices[3].strokeWidth = 2
pc.slices[3].strokeDashArray = [2, 2]
pc.slices[3].labelRadius = 1.75
pc.slices[3].fontColor = colors.red
drawing.add(pc)
elements.append(drawing)
elements.append(Spacer(1, 0.7 * inch))
示例11: generar_pdf_busquedas_view
# 需要导入模块: from reportlab.graphics.charts.piecharts import Pie [as 别名]
# 或者: from reportlab.graphics.charts.piecharts.Pie import height [as 别名]
def generar_pdf_busquedas_view(request):
print "Genero el PDF"
fecha_m = ""
resultados=[]
fecha_a = ""
b=[]
t=[]
fecha_inicio = x
fecha_final = y
c=0
r=[]
#story =[]
response = HttpResponse(content_type='application/pdf')
pdf_name = "reporte_busqueda.pdf" # llamado clientes
# la linea 26 es por si deseas descargar el pdf a tu computadora
response['Content-Disposition'] = 'attachment; filename=%s' % pdf_name
buff = BytesIO()
doc = SimpleDocTemplate(buff,
pagesize=letter,
rightMargin=40,
leftMargin=40,
topMargin=60,
bottomMargin=18,
)
reportes = []
styles = getSampleStyleSheet()
fichero_imagen="biblioteca/media/images/Reports-banner.jpg"
imagen_logo=Image(os.path.realpath(fichero_imagen),width=400,height=100)
reportes.append(imagen_logo)
header = Paragraph("Fecha del reporte: "+str(date.today()), styles['Heading1'])
header2 = Paragraph("Reporte de las busquedas realizadas entre la fecha "+str(fecha_inicio)+" hasta la fecha "+str(fecha_final) + "\n", styles['Normal'])
salto_linea = Paragraph("\n\n", styles["Normal"])
reportes.append(header)
reportes.append(header2)
reportes.append(Spacer(1, 12))
headings = ('Busqueda', 'Resultado',)# 'Cantidad_Veces_Buscadas')
lista=[]
t = Busqueda.objects.all()
b = Busqueda.objects.filter(fecha__range=(fecha_inicio, fecha_final)).values('busqueda', 'resultados').distinct()
listar=[]
for r in b:
print "llllllllllllllllll",r,"\n"
if r['resultados'] == False:
r['resultados']="No se encontró"
listar.append(r)
else:
r['resultados']="Se encontró"
listar.append(r)
print "lisygyujgyjgjhbjh", listar
#GRAFICAS BARRA
total_busquedas=Busqueda.objects.all().count() #TOTAL BUSQUEDAS
si=Busqueda.objects.filter(resultados=True).count() #BUSUEDAS ENCONTRADAS (SI)
no=total_busquedas-si #BUSQUEDAS NO ENCONTRADAS (NO)
#GRAFICAS PASTEL
for i in b:
print "________________",i.get("busqueda")
for j in t:
print "===============",j.busqueda
if j.busqueda == i.get("busqueda") and j.fecha >= fecha_inicio and j.fecha <= fecha_final:
c = c + 1
print c
lista.append(c)
c=0
print lista , len(lista)
li = zip(b,lista)
'''
#.........这里部分代码省略.........
示例12: generate_certificate
# 需要导入模块: from reportlab.graphics.charts.piecharts import Pie [as 别名]
# 或者: from reportlab.graphics.charts.piecharts.Pie import height [as 别名]
def generate_certificate(elements):
styles = ParagraphStyle(
name='Normal',
fontName='Helvetica-Bold',
fontSize=15,
alignment=1,
)
elements.append(Spacer(1, 0.5 * inch))
i = Paragraph(str("candidate performance vs average performance"), styles)
elements.append(i)
elements.append(Spacer(1, 0.1 * inch))
drawing = Drawing(0, 200) # for indices
data = [
(13, 5, 20, 22, 37, 45, 19, 4),
(14, 6, 21, 23, 38, 46, 20, 5)
] # data for drawing bar graphs
bc = VerticalBarChart()
bc.x = 0 # x,y define the left bottom of graph
bc.y = 0
bc.height = 150
bc.width = 300
bc.data = data
bc.strokeColor = colors.black
bc.valueAxis.valueMin = 0
bc.valueAxis.valueMax = 50
bc.valueAxis.valueStep = 10
bc.categoryAxis.labels.boxAnchor = 'ne'
bc.categoryAxis.labels.dx = 6 # next 3 lines is for naming indices
bc.categoryAxis.labels.dy = -2
bc.categoryAxis.labels.angle = 60
bc.categoryAxis.categoryNames = ['Jan-99', 'Feb-99', 'Mar-99',
'Apr-99', 'May-99', 'Jun-99', 'Jul-99', 'Aug-99']
drawing.add(bc)
elements.append(drawing)
elements.append(Spacer(1, 0.5 * inch))
drawing = Drawing(0, 175) # for indices
lc = HorizontalLineChart()
lc.x = 0
lc.y = 10
lc.height = 150
lc.width = 300
lc.data = data
lc.joinedLines = 1
catnames = 'Jan Feb Mar Apr May Jun Jul Aug'.split(' ')
lc.categoryAxis.categoryNames = catnames
lc.categoryAxis.labels.boxAnchor = 'n'
lc.valueAxis.valueMin = 0
lc.valueAxis.valueMax = 60
lc.valueAxis.valueStep = 15
lc.lines[0].strokeWidth = 2
lc.lines[1].strokeWidth = 1.5
drawing.add(lc)
elements.append(drawing)
drawing = Drawing(0, 400) # for indices
data = [
((1, 1), (2, 2), (2.5, 1), (3, 3), (4, 5)),
((1, 2), (2, 3), (2.5, 2), (3.5, 5), (4, 6))
]
elements.append(Spacer(1, 0.1 * inch))
i = Paragraph(str("candidate performance vs average performance"), styles)
elements.append(i)
elements.append(Spacer(1, 0.1 * inch))
lp = LinePlot()
lp.x = 0
lp.y = 50
lp.height = 300
lp.width = 600
lp.data = data
lp.joinedLines = 1
lp.lines[0].symbol = makeMarker('FilledCircle')
lp.lines[1].symbol = makeMarker('Circle')
lp.lineLabelFormat = '%2.0f'
lp.strokeColor = colors.black
lp.xValueAxis.valueMin = 0
lp.xValueAxis.valueMax = 5
lp.xValueAxis.valueSteps = [1, 2, 2.5, 3, 4, 5]
lp.xValueAxis.labelTextFormat = '%2.1f'
lp.yValueAxis.valueMin = 0
lp.yValueAxis.valueMax = 7
lp.yValueAxis.valueSteps = [1, 2, 3, 5, 6]
drawing.add(lp)
elements.append(drawing)
elements.append(Spacer(1, 0.1 * inch))
drawing = Drawing(100, 350)
pc = Pie()
pc.x = 65
pc.y = 15
pc.width = 300
pc.height = 300
pc.data = [10, 20, 30, 40, 50, 60]
pc.labels = ['a', 'b', 'c', 'd', 'e', 'f']
pc.slices.strokeWidth = 0.5
pc.slices[3].popout = 10
pc.slices[3].strokeWidth = 2
pc.slices[3].strokeDashArray = [2, 2]
pc.slices[3].labelRadius = 1.75
pc.slices[3].fontColor = colors.red
drawing.add(pc)
elements.append(drawing)
elements.append(Spacer(1, 0.7 * inch))
#.........这里部分代码省略.........
示例13: Drawing
# 需要导入模块: from reportlab.graphics.charts.piecharts import Pie [as 别名]
# 或者: from reportlab.graphics.charts.piecharts.Pie import height [as 别名]
pc.slices[3].strokeDashArray = [2,2]
pc.slices[3].labelRadius = 1.75
pc.slices[3].fontColor = colors.red
d.add(pc)
""")
from reportlab.graphics.charts.piecharts import Pie
d = Drawing(200, 100)
pc = Pie()
pc.x = 65
pc.y = 15
pc.width = 70
pc.height = 70
pc.data = [10,20,30,40,50,60]
pc.labels = ['a','b','c','d','e','f']
pc.slices.strokeWidth=0.5
pc.slices[3].popout = 10
pc.slices[3].strokeWidth = 2
pc.slices[3].strokeDashArray = [2,2]
pc.slices[3].labelRadius = 1.75
pc.slices[3].fontColor = colors.red
d.add(pc)
draw(d, 'A bare bones pie chart')
disc("""
示例14: ListadoUsos
# 需要导入模块: from reportlab.graphics.charts.piecharts import Pie [as 别名]
# 或者: from reportlab.graphics.charts.piecharts.Pie import height [as 别名]
def ListadoUsos(request):
response = HttpResponse(mimetype='application/pdf')
response['Content-Disposition'] = 'attachment; filename=num_aprobados_reprobados.pdf; pagesize=A4;'
#Esta lista contendra todos los elementos que se dibujaran en el pdf
elementos = []
doc = SimpleDocTemplate(response)
styleSheet = getSampleStyleSheet()
#---> Estilo Titulo
el_titulo = styleSheet['Heading1']
el_titulo.alignment = TA_CENTER
el_titulo.spaceBefore = 15
el_titulo.fontSize = 12
el_titulo.fontName = 'Helvetica'
txtInfo = u'<br />A.C.C.E.M.A:'
# Estilo txtInfo
info = styleSheet['Normal']
info.fontSize = 12
info.alignment = TA_LEFT
info.fontName = 'Helvetica'
infoV = Paragraph(txtInfo, info)
#-->Estilo tabla
x = [
('ALIGN', (0,0), (-1,-1), 'CENTER'),
('TOPPADDING', (0,0), (-1,-1), 1),
('BOTTOMPADDING', (0,0), (-1,-1), 2),
('GRID', (0,0), (-1,-1), 0.80, colors.black),
('FONT', (0,0), (-1,-1), "Helvetica", 10),
('FONT', (0,0), (1,0), "Helvetica-Bold", 12),
]
tabla = []
#--> Titulo de la constancia
elementos.append(Spacer(1,5))
Titulo = Paragraph('<b>Estadisticas de usos</b>', el_titulo)
elementos.append(Titulo)
elementos.append(Spacer(1,5))
#--> Añadiendo la Informción antes del cuadro
elementos.append(infoV)
elementos.append(Spacer(1,10))
usuarios = User.objects.all()
usos = UsosDisp.objects.all()
tabla.append([' CANTIDAD DE USUARIOS', u'NÚMERO DE USOS'])
tabla.append(['%s'%(usuarios.__len__()), u'%s'%(usos.__len__())])
t1 = Table(tabla, colWidths=('', ''))
t1.setStyle(TableStyle(x))
elementos.append(t1)
#--> Calculando los porcentajes
total = usos.__len__()
#--> Frame del gráfico
frame = Drawing(350,200)
torta = Pie()
torta.x = 125
torta.y = 35
torta.width = 120
torta.height = 120
torta.labels = []
contador = 0
for i in usuarios:
#import ipdb;ipdb.set_trace()
uso_actual = usos.filter(Usuario=i).count()
porcen_usuario = (float(uso_actual) * 100) / total
torta.labels.append('%3.2f%% %s'%(porcen_usuario, i.username))
torta.data.append(porcen_usuario)
#--> Estilos del gráfico
torta.slices.labelRadius = 1
torta.sideLabels = 1
torta.slices.fontSize = 8
torta.slices.fontName = 'Helvetica-Bold'
torta.slices.strokeWidth = 2
torta.slices.popout = 10
frame.add(torta)
elementos.append(frame)
doc.build(elementos, canvasmaker=NumeroDePagina )
return response
示例15: __per_account_statistic
# 需要导入模块: from reportlab.graphics.charts.piecharts import Pie [as 别名]
# 或者: from reportlab.graphics.charts.piecharts.Pie import height [as 别名]
def __per_account_statistic(self):
for acc in self.accounts:
p = PageBreak()
p.drawOn(self.c, 0, 1000)
self.c.showPage()
self.l = 760
self.c.setFont('Courier', 14)
self.c.drawString(30, 800, 'Cuenta: %s' % \
acc.name)
header = ['Fecha', 'Tipo', 'Monto', 'Description']
data = [header]
g_data = list()
g_labe = list()
total = 0
for tra in self.transactions:
if tra.account == acc.name:
if tra.t_type in ['expense', 'transfer']:
tipo = self.__translate_type(tra.t_type)
data.append([tra.date, tipo.upper(),
'$%2.f' % tra.amount, tra.description])
total += tra.amount
g_data.append(tra.amount)
g_labe.append(tra.description.encode('utf-8'))
data.append(['TOTAL', '', '$%.2f' % total, ''])
if len(g_data) == 0 or len(g_labe) == 0:
self.c.setFont('Courier', 12)
self.c.drawString(30, 770, 'Sin movimientos negativos')
continue
from_title = 35
if len(data) != 2:
self.l -= ((len(data) * len(data)) + len(data)) + from_title
t = Table(data)
t.setStyle(TableStyle([('INNERGRID', (0,0), (-1,-1), 0.25, black),
('BOX', (0,0), (-1,-1), 0.25, black),
('FONTNAME', (0,0), (-1,0), 'Courier-Bold'),
('BACKGROUND', (0,0), (-1,0), HexColor('#efeded')),
('BACKGROUND', (0,0), (0,-1), HexColor('#efeded')),
('FONTSIZE', (0,0), (-1,0), 12),
('FONTSIZE', (0,1), (-1,-1), 8),
('FONTNAME', (0,1), (-1,-1), 'Courier'),
('BACKGROUND', (0,-1), (-1,-1), red),
('TEXTCOLOR', (0,-1), (-1,-1), white)]))
t.wrapOn(self.c, 30, self.l)
t.drawOn(self.c, 30, self.l)
drawing = Drawing(200, 100)
pie = Pie()
pie.x = 30
pie.y = self.l - 300
pie.height = 200
pie.width = 200
pie.data = g_data
pie.labels = g_labe
pie.simpleLabels = 1
pie.slices.strokeWidth = 1
pie.slices.strokeColor = black
pie.slices.label_visible = 0
pie.slices.popout = 1
#pie.labels = map(str, pie.data)
legend = Legend()
legend.x = 250
legend.y = self.l - 250
legend.dx = 8
legend.dy = 8
legend.fontName = 'Helvetica'
legend.fontSize = 7
legend.boxAnchor = 'w'
legend.columnMaximum = 10
legend.strokeWidth = 1
legend.strokeColor = black
legend.deltax = 75
legend.deltay = 10
legend.autoXPadding = 5
legend.yGap = 0
legend.dxTextSpace = 5
legend.alignment = 'right'
legend.dividerLines = 1|2|4
legend.dividerOffsY = 4.5
legend.subCols.rpad = 30
n = len(pie.data)
self.__setItems(n,pie.slices,
'fillColor',self.pdf_chart_colors)
legend.colorNamePairs = [(pie.slices[i].fillColor,
(pie.labels[i][0:20],'$%0.2f' % pie.data[i])) for i in xrange(n)]
#.........这里部分代码省略.........