Hi Zope users. Please excuse another dumb question. I wish to produce some dynamic graphs inside Zope to display biological data. I am using pychart, this is clean and IMO has the best looking output for least amount of effort. I can produce graphics by writing a .png file to disk, and then reading it back to return to the client as RESPONSE. This is not optimal - why do I bother writing something to disk, to read it again to delete it? I have had a play using cStringIO, but cannot make this work. Does anyone have any pointers or examples of how I can create graphics in PyChart and display them using Zope without needing to write binary intermediates to the filesystem? Thanks Stephen ----------------------------------------- Dr Stephen Rudd - genome astronomer Bioinformatics group Turku Centre for Biotechnology Tel. +358 2 333 8611 Fax. +358 2 333 8000 ------------------------------------------
From: "Stephen Rudd" <stephen.rudd@btk.utu.fi>
Please excuse another dumb question. I wish to produce some dynamic graphs inside Zope to display biological data. I am using pychart, this is clean and IMO has the best looking output for least amount of effort. I can produce graphics by writing a .png file to disk, and then reading it back to return to the client as RESPONSE. This is not optimal - why do I bother writing something to disk, to read it again to delete it?
I have had a play using cStringIO, but cannot make this work. Does anyone have any pointers or examples of how I can create graphics in PyChart and display them using Zope without needing to write binary intermediates to the filesystem?
I use cStringIO, but with a graphics package called 'gdchart'. Here are a few relevant code bits:
From the calling routine (a dtml method):
<dtml-let agraph="graphics(graphtype)"> ... do something with 'agraph' The external method ('graphics.py'): import gdchart import cStringIO # optional from chart import Chart class TestChart(Chart): def __init__(self): Chart.__init__(self) def draw(self, style, size, file, labels, *data): Chart.draw(self) args = (style, size, file, labels) + data apply(gdchart.chart, args) def graphics(gtype): c = TestChart() rfile = cStringIO.StringIO() c.draw(gdchart.GDC_BAR, size, rfile, days, datalist) return rfile HTH Jonathan
Stephen Rudd wrote:
I have had a play using cStringIO, but cannot make this work.
Try being a bit mroe verbose about this... what error? what traceback? etc Chris -- Simplistix - Content Management, Zope & Python Consulting - http://www.simplistix.co.uk
participants (3)
-
Chris Withers -
Small Business Services -
Stephen Rudd