http://chart.apis.google.com/chart?cht=p3&chd=t:60,40&chs=250x100&chl=Hello|World
就可以得到這樣的圓餅圖:
只是輸入的資料都只能用get的方式丟給chart api, google另外提供了資料encode的方式, 以及提供javascript 的範例將資料送入google api, 將chart畫出。但後來發現我把unicode的中文直接丟入get的參數值裡, 都會變成亂碼, 所以必須先將 unicode的字串先做quote()處理:
urls=urls.encode('utf8')
urls=urllib.quote(urls,'&=')
http://chart.apis.google.com/chart?chd=t%3A41.3%2C33.02%2C11.74%2C10.01%2C2.6%2C1.33&chl=%E7%9C%BC%E7%9D%9B%E5%A4%A7%2841.3%25%29%7C%E8%84%B8%E5%A4%A7%2833.02%25%29%7C%E5%B1%81%E8%82%A1%E5%A4%A7%2811.74%25%29%7C%E6%9D%8E%E5%AE%87%E6%98%A5%2810.01%25%29%7C%E7%BE%8E%E8%8B%A5%E5%A4%A9%E4%BB%99%282.6%25%29%7C%E8%83%B8%E9%83%A8%E5%A4%A7%281.33%25%29&chs=600x200&cht=p3&chtt=%E4%BD%A0%E5%A5%B3%E6%9C%8B%E5%8F%8B%E6%BC%82%E4%BA%AE%E5%90%97%28%E6%9B%BE%E7%A7%8B%29&chco=3399cc&chts=333333%2C25
然後就得到我們要的樣子了: