|
|
@ -41,6 +41,10 @@ def main():
|
|
|
|
print("New time series.")
|
|
|
|
print("New time series.")
|
|
|
|
ts = TimeSeries(states=set(), jobstates=set(), data=dict())
|
|
|
|
ts = TimeSeries(states=set(), jobstates=set(), data=dict())
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
plt.ion()
|
|
|
|
|
|
|
|
plt.clf()
|
|
|
|
|
|
|
|
plt.show(block=False)
|
|
|
|
|
|
|
|
|
|
|
|
while True:
|
|
|
|
while True:
|
|
|
|
time, states, jobstates = get_data()
|
|
|
|
time, states, jobstates = get_data()
|
|
|
|
print(f'data got at {time}')
|
|
|
|
print(f'data got at {time}')
|
|
|
@ -56,8 +60,6 @@ def main():
|
|
|
|
print('pickle saved')
|
|
|
|
print('pickle saved')
|
|
|
|
|
|
|
|
|
|
|
|
# Show the plot
|
|
|
|
# Show the plot
|
|
|
|
plt.close()
|
|
|
|
|
|
|
|
plt.clf()
|
|
|
|
|
|
|
|
x = sorted(ts.data.keys()) # times
|
|
|
|
x = sorted(ts.data.keys()) # times
|
|
|
|
states = sorted(ts.states)
|
|
|
|
states = sorted(ts.states)
|
|
|
|
ys = [tuple(ts.data[time][0].get(state, 0) for state in states) for time in x] # numbers per state
|
|
|
|
ys = [tuple(ts.data[time][0].get(state, 0) for state in states) for time in x] # numbers per state
|
|
|
@ -67,7 +69,6 @@ def main():
|
|
|
|
plt.stackplot(x, ys, labels=states)
|
|
|
|
plt.stackplot(x, ys, labels=states)
|
|
|
|
plt.legend(loc='upper left')
|
|
|
|
plt.legend(loc='upper left')
|
|
|
|
print('showing plot')
|
|
|
|
print('showing plot')
|
|
|
|
plt.show(block=False)
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
plt.pause(poll_rate)
|
|
|
|
plt.pause(poll_rate)
|
|
|
|
|
|
|
|
|
|
|
|