Skip to content

Instantly share code, notes, and snippets.

@dsingleton
Created November 4, 2009 12:50
Show Gist options
  • Save dsingleton/226012 to your computer and use it in GitHub Desktop.
Save dsingleton/226012 to your computer and use it in GitHub Desktop.
#!/usr/bin/python
import sys
labels = []
values = []
for line in sys.stdin:
value, label = line.strip().split(' ')
labels.append(label)
values.append(int(value))
values = [value * 100 / sum(values) for value in values]
print "http://chart.apis.google.com/chart?cht=p&chd=t:%s&chs=600x300&chl=%s" % ( ','.join(map(str,values)), '|'.join(labels))
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment