def charttest(): import gdchart sizes = [random.randrange(10, 20) for i in range(10)] x = gdchart.Line() x.width = 250 x.height = 250 x.xtitle = "sample" x.ytitle = "size" x.title = "Example Graph" #x.ext_color = [ "white", "yellow", "red", "blue", "green"] x.setData(sizes) #x.setLabels(["Mon", "Tue", "Wed", "Thu", "Fri"]) x.draw("simple.png")
def chartLine(): shelve_file = shelve.open("File/BytesSumPerHost.bat") #元组列表 items_list = [(i[1],i[0]) for i in shelve_file.items()] items_list.sort() bytes_sent = [i[0] for i in items_list] ip_addresses = [i[1] for i in items_list] chart = gdchart.Line() chart.width = 400 chart.height = 400 chart.bg_color = "white" chart.plot_color = "black" chart.xtitle = "Tasktracker Nums" chart.ytitle = "Time (s)" chart.title = "Block Size 8MB,Block Nums 8" chart.setData([0,501.174,469.293,452.384,464.434,475.99,307.415]) chart.setLabels([0,3,4,5,6,7,8]) chart.draw("File/linevideo1.png") shelve_file.close()