[Zope] ZGDChart product...
Furbach, Andreas
andreas.furbach@eds.com
Wed, 15 Nov 2000 07:02:37 -0000
Hello.
The function _chartdata in ZGDchart.py returns only one label column and one
data column.
You may want to change this to:
*********************************************************************
def _chartdata(self):
"""
return the first and second columns of sql query
results as a pair of tuples
"""
rows = getattr(self, self.SQL)()
# data[0] is list of labels
data = []
start = 0
for row in rows:
# each row is a list of fields
# initialize empty lists for each column
if start == 0:
start = 1
for i in range(len(row)):
data.append([])
#
# Only insert rows with zero values if
# it is not a pie chart
# Pie Chart only makes sense with 1 data column
#
for i in range(len(row)):
if (self.REQUEST['zgdchart_runtime_type'] !=
GDC_3DPIE and self.REQUEST['zgdchart_runtime_type'] != GDC_2DPIE) or row[1]
!= 0:
#
# Coerce the first field into a string
# and other fields into a float
#
if i == 0:
data[i].append( str (row[i]))
else:
data[i].append( float(row[i]))
#
# convert lists to tuples
# apparently, gdchart.chart() accepts lists
# as well, but I better check with
# M Steed first.
#
# I just tried.
return data
****************************************************************************
***
and restart Zope, which worked for me.
Andreas Furbach
_______________________________________________________
EDS Informationstechnologie und Service GmbH
Semerteichstr. 50-52
D-44141 Dortmund
Tel.: 0231 / 944-1533
mailto: andreas.furbach@eds.com
>Hi.
>
>This is really a great product.
>
>Unfortunately, I'm not able to create a chart with multiple columns using a
>ZSQL Data Method.
>Multiple columns with a DTML-Method works fine.
>
>Do I miss something. Any ideas?
>
>Thanks for any help. Regards, Marc Ludwig (zope@isp.lu)