def drawgraph(markethistory):
global graphdrawn
# Set up a graph and data sets
timeplots = []
priceplots = []
# Set up the graph
figgraph = Figure(figsize=(10, 10), dpi=60)
# 2D Graph : 1 column, 1 Row, 1 Plot
axes = figgraph.add_subplot(111)
for key in markethistory:
figgraph.suptitle(markethistory[key].Label)
price = markethistory[key].Price
timestamp = markethistory[key].Timestamp
dtplot = datetime.datetime.fromtimestamp(timestamp)
timeplots.insert(len(timeplots), dtplot)
priceplots.insert(len(priceplots), price)
# Enforce 8 decimal places
axes.yaxis.set_major_formatter(FormatStrFormatter('%.8f'))
# Plot the graph
axes.plot(timeplots, priceplots)
# Canvas placed in main frame, controlled by figgraph
window.canvas = FigureCanvasTkAgg(figgraph, master=window.mainframe)
window.canvas.get_tk_widget().place(relx=0.26, rely=0.01, relheight=0.46, relwidth=0.74)
window.canvas.draw()
graphdrawn = True
# Sell order list select event.
评论列表
文章目录