def simpleEncode(values,maxValue): # values is a python list of numbers # based on simpleEncode(values,maxValue) from # http://code.google.com/apis/chart/ simpleEncoding = 'ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz0123456789' chartData = ['s:'] for i in values: if str(i).isdigit() and i >= 0: chartData.append(simpleEncoding[(len(simpleEncoding)-1) * i/maxValue ]) else: chartData.append('_') return ''.join(chartData)note that the if str(i).isdigit() bit isn't needed you pass in a list of numbers, and in JScript you have typing done less strictly, hence the need to ensure it's a number. this should work for any of the chart types - bar, pie, line, etc ... just change the other URL parameters. i would also probably cut back on the long variable names.
next Sunday, Feb 03, 2008 @ 03:56pm | previous Saturday, Aug 11, 2007 @ 06:48pm | archives
|Last modified: Sunday, Dec 09, 2007 @ 08:00am|
copyright © 2002-2005 jose nazario, all rights reserved.