rendered paste body#!/usr/bin/env pythonimport mathdef simpleEncode(values, maxValue): simpleEncoding = "ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz0123456789" chartdata = "s:" for x in values: currentValue = x if isinstance(currentValue, (int, long, float, complex)): idx = int(math.floor(61 * currentValue / maxValue)) print idx chartdata = chartdata + simpleEncoding[idx] else: chartdata = chartdata + "_" return chartdatadef buildUrl(data, xlabels, ymax, size): xstr = "" st = simpleEncode(data, ymax) for label in xlabels: xstr = xstr + "|%s" %label url = "http://chart.apis.google.com/chart?chs=%s&cht=lc&chxt=x,y&chxl=0:%s1:|0|%s&chd=%s" %(size, xstr, ymax, st) return url