Hi Harlow, You're getting confused because you have a cgi environment. An externbal method is a "Zope thing" though, it needs to return whatever you want Zope to return to the browser... hpinson@indepthl.com wrote:
#!/usr/bin/python2.3
You don't need this, this will never be executed as a script.
def drawBarChart():
from pychartdir import *
from cStringIO imort StringIO output = StringIO()
#The data for the bar chart data = [85, 156, 179.5, 211, 123]
#The labels for the bar chart labels = ["Mon", "Tue", "Wed", "Thu", "Fri"]
#Create a XYChart object of size 250 x 250 pixels c = XYChart(250, 250)
#Set the plotarea at (30, 20) and of size 200 x 200 pixels c.setPlotArea(30, 20, 200, 200)
#Add a bar chart layer using the given data c.addBarLayer(data)
#Set the x axis labels using the given labels c.xAxis().setLabels(labels)
#output the chart
print >> output, "Content-type: image/png\n"
binaryPrint(c.makeChart2(PNG))
# you need to get the above to append what it generates to 'output'. return output.getvalue() cheers, Chris -- Simplistix - Content Management, Zope & Python Consulting - http://www.simplistix.co.uk