Contact Us!
CoCalc Logo Icon
StoreFeaturesDocsShareSupportNewsAboutSign UpSign In
sagemathinc

Real-time collaboration for Jupyter Notebooks, Linux Terminals, LaTeX, VS Code, R IDE, and more,
all in one place. Commercial Alternative to JupyterHub.

GitHub Repository: sagemathinc/cocalc-example-files
Path: blob/master/sage/interact/WebApp/pieChart.sagews
Views: 1120
# Google Chart API: http://code.google.com/apis/chart import urllib2 as inet from pylab import imshow @interact def gChart(title="Google Chart API plots Pie Charts!", color1=Color('purple'), color2=Color('black'), color3=Color('yellow'), val1=slider(0,1,.05,.5), val2=slider(0,1,.05,.3), val3=slider(0,1,.05,0.1), label=("Maths Physics Chemistry")): url = "http://chart.apis.google.com/chart?cht=p3&chs=600x300" url += '&chtt=%s&chts=000000,25'%title.replace(" ","+") url += '&chco=%s'%(','.join([color1.html_color()[1:],color2.html_color()[1:],color3.html_color()[1:]])) url += '&chl=%s'%label.replace(" ","|") url += '&chd=t:%s'%(','.join(map(str,[val1,val2,val3]))) print url html('<div style="border:3px dashed;text-align:center;padding:50px 0 50px 0"><img src="%s"></div>'%url)
Interact: please open in CoCalc