#!/usr/bin/env python # show python where the web modules are import sys sys.path.append('../') sys.path.append('../../../') import web.image.graph graph = web.image.graph.ScatterGraph( xAxis={'max':200, 'unit':20, 'label':'Value 1 /cm^2'}, yAxis={'max':200, 'unit':20, 'label':'Value 2 /cm^2'}, points=[(0,0),(13,68),(200,200)], size=(500, 300), bgColor=(240,240,240), title='Test Graph' ) graph.save('scatter.ps') graph = web.image.graph.BarGraph( xAxis={'max':200, 'unit':20, 'label':'Value 1 /cm^2'}, yAxis={'max':200, 'unit':20, 'label':'Value 2 /cm^2'}, points=[10,20,40,50,200,89, 30, 60, 70, 60], size=(500, 300), bgColor=(240,240,240), title='Test Graph' ) graph.save('bar.png') graph = web.image.graph.PieChart( points={ 'food':10, 'numbers':20, 'numbers2':30, }, size=(500, 300), bgColor=(240,240,240), title='Test Graph' ) graph.save('pie.jpg') graph = web.image.graph.BarGraph( xAxis={'max':200, 'unit':20, 'label':'Value 1 /cm^2'}, yAxis={'max':200, 'unit':20, 'label':'Value 2 /cm^2'}, points=[10,20,40,50,200,89, 30, 60, 70, 60], size=(500, 300), bgColor=(240,240,240), title='Test Graph' ) fp = open('test.png','wb') fp.write(graph.toString('png')) fp.close()