[Zope] Using pychart from a Zope product

Dieter Maurer dieter at handshake.de
Thu Jan 27 12:53:23 EST 2005


Reuven M. Lerner wrote at 2005-1-26 13:37 -0600:
[DM]
>>You are missing that we need your piece of code that interfaces
>>"PyChart" with Zope. How do you pass the result of "PyChart"
>>back to Zope/ZPublisher?
> ...
>For now, I just wanted to save the resulting chart to disk...
> ...
>The following is the method that I wrote in my Zope product, taken 
>almost 100 percent from one of the demos that came with PyChart:
>
>        def return_basic_chart(self, REQUEST):
>            "Return a basic chart"
>
>            can = canvas.init("/tmp/chart.pdf")
> ...
>            ar = area.T(x_axis=xaxis, y_axis=yaxis, y_range=(0,None))
> ...
>            ar.draw(can)
>
>            return "drawn"
>
>As I wrote in my previous note, the above code executes without any 
>errors.  And I get the plain-text "drawn" in my Web browser when I go to 
>the /return_basic_chart method via the browser.  But no chart is 
>actually generated on disk, so far as I can tell.

I expect that you must tell your canvas that it should write
its content to disk (however, I do not know "Pychart").

>If there's a better/smarter way to take PyChart output and display it 
>via Zope, I'm all in favor.

There is "ZGDChart". It's a Zope interface to the "GDChart" package.
Maybe, you look at it and how it exposes charts to Zope.

-- 
Dieter


More information about the Zope mailing list