def animate(ii): most_recent = Reader.get_timeset(table="Sensor Plot", num=1) Reader.close() for i, key in enumerate(param_dict, 1): current_plot = param_dict[key] data_stream = current_plot.incoming_data data_stream.pop() data_stream.insert(1, most_recent[0][i]) current_plot.incoming_data = data_stream current_plot.make_plot(param=key)
def GetValues(): with open(config_path, "r") as file: config_settings = list(csv.reader(file)) most_recent = Reader.get_timeset(table="Sensor Plot", num=1) Reader.close() for i, key in enumerate(param_dict): current_param_val = most_recent[0][i] live_text = live_text_label[i] current_plot = param_dict[key] if current_param_val > float( config_settings[3][i]) or current_param_val < float( config_settings[4][i]): live_text.config(text=most_recent[i], fg="red", bg="white") current_plot.plot_color = 'r' else: live_text.config(text=most_recent[i], fg="black", bg="white") current_plot.plot_color = 'g' self.after(5000, GetValues)
ax.xaxis.set_major_formatter(mdates.DateFormatter('%I:%M:%S %p')) [tk.set_visible(True) for tk in ax.get_xticklabels()] [label.set_rotation(10) for label in ax.xaxis.get_ticklabels() ] #slant the x axis tick labels for extra coolness ax.set_xlim(incoming_data[-1], incoming_data[0]) ax.xaxis.set_major_locator(mticker.MaxNLocator(nbins=4)) plot.fill_between(tList, incoming_data, facecolor=plot_color, edgecolor=plot_color, alpha=0.5) #blue @initilization for i, param in enumerate(param_list, 1): #tk.Label self refers to Homepage most_recent = Reader.get_timeset(table="Sensor Plot", num=20) Reader.close() for j in enumerate(most_recent): tList = most_recent[j][0] most_recent_20 = most_recent[j][i] param_dict[param] = Sensor_Plot(f.add_subplot(6, 2, i), most_recent_20, 'b') for i, key in enumerate(param_dict, 1): current_plot = param_dict[key] current_plot.make_plot(param=key) ###ANIMATE FUNCTION, REMOVE LAST ITEM FROM MOST_RECENT_2O LIST AND INSERT FRESHLY CALLED VALUE TO INDEX[1] def animate(ii): most_recent = Reader.get_timeset(table="Sensor Plot", num=1)