From 89777aeaeb18b7bf64a28444cea4e1eefc1ee4a1 Mon Sep 17 00:00:00 2001 From: Jay Vora Date: Fri, 17 Oct 2008 13:03:47 +0530 Subject: [PATCH] Account_report:Added beautiful graph in report bzr revid: jvo@tinyerp.com-20081017073347-vq2mk2e478bsj7ab --- addons/account_report/report/print_indicator.py | 9 +++++++-- addons/account_report/report/print_indicator.rml | 2 +- 2 files changed, 8 insertions(+), 3 deletions(-) diff --git a/addons/account_report/report/print_indicator.py b/addons/account_report/report/print_indicator.py index ec0e84fb314..0edc802c7a1 100644 --- a/addons/account_report/report/print_indicator.py +++ b/addons/account_report/report/print_indicator.py @@ -45,6 +45,9 @@ from report.interface import report_int from pychart import * import StringIO theme.use_color = 1 +theme.default_font_family = "Helvetica-Bold" +theme.default_font_size = 18 +theme.default_line_width = 1.0 import tools @@ -223,20 +226,22 @@ class accounting_report_indicator(report_sxw.rml_parse): os.mkdir('./' + dirname + '/') pdf_string = StringIO.StringIO() can = canvas.init('Image'+str(self.count)+".png") +# can.clip(0,0,600,400) chart_object.set_defaults(line_plot.T, line_style=None) data=zip(self.header_name,self.header_val) - ar = area.T(size = (400,200),x_coord = category_coord.T(data, 0), y_range = (0, None), + ar = area.T(size = (650,450),x_coord = category_coord.T(data, 0), y_range = (None, None), x_axis = axis.X(label="Period//Year",format="/a-30{}%s"), y_axis = axis.Y(label="Value")) - ar.add_plot(bar_plot.T(data = data, label = "Value",fill_style=fill_style.red)) + ar.add_plot(bar_plot.T(data = data,width=15, data_label_format="/o/17{}%s",label = "Value",fill_style=fill_style.red)) ar.draw() can.close() os.system('cp '+'Image'+str(self.count)+'.png ' +path+str(self.count)+'.png') os.system('rm '+'Image'+str(self.count)+'.png') +# can.endclip() return path+str(self.count)+'.png' report_sxw.report_sxw('report.print.indicators', 'account.report.history', diff --git a/addons/account_report/report/print_indicator.rml b/addons/account_report/report/print_indicator.rml index 6727812fc6f..479eb853424 100644 --- a/addons/account_report/report/print_indicator.rml +++ b/addons/account_report/report/print_indicator.rml @@ -128,7 +128,7 @@ -[[ o['disp_graph'] and setTag('para','image',{'file':test(data['form'],o)}) or removeParentNode('para') ]] +[[ o['disp_graph'] and setTag('para','image',{'width':'450.00','height':'200.00','file':test(data['form'],o)}) or removeParentNode('para') ]]