-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathgraphics.py
31 lines (22 loc) · 845 Bytes
/
graphics.py
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
import pygal
import numpy as np
class LineGraph:
lineGraph = pygal.Line()
def __init__(self, title, allruns, lengthOfPath):
self.lineGraph.title = title
self.lineGraph.x_labels = map(str, range(0, lengthOfPath))
distanceBuffer = np.array([])
timeBuffer = np.array([])
print("All Runs: ", allruns)
for i in range(0, lengthOfPath):
print(allruns[i])
if i % 2:
timeBuffer = np.append(timeBuffer, allruns[i])
else:
distanceBuffer = np.append(distanceBuffer, allruns[i])
print(allruns.tolist())
print(timeBuffer.tolist())
self.lineGraph.add("Max Distance", distanceBuffer)
self.lineGraph.add("Time To Finish", timeBuffer)
def draw(self):
self.lineGraph.render_in_browser()