[Zope] ChartDirector and Zope

hpinson at indepthl.com hpinson at indepthl.com
Fri Feb 11 18:03:07 EST 2005


Has anyone gotten the (excellent) ChartDirector charting library to 
work with zope?

Here's what I have tried:

1. Created an ExternalMethod named barchart.py, in the Extensions 
folder:

#!/usr/bin/python2.3

def drawBarChart():

  from pychartdir import *

  #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 "Content-type: image/png\n"
  binaryPrint(c.makeChart2(PNG))
  
  
2. Add an external method in the ZMI
id: barchart
title: black
module name: barchart
function name: drawBarChart

3. Create a dtml method to call it, named callchart.htm with 
contents:

<img src="<dtml-var barchart>">

4. When run, this returns: none


What am I doing wrong?

Thanks!

Harlow Pinson
Indepth Learning
Email: hpinson at indepthl.com 
Web: http://www.indepthl.com
Voice: 505-994-2135
FAX: 208-475-7678



More information about the Zope mailing list