Example #1
0
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)
Example #2
0
        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)
Example #3
0
         ]  #slant the x axis tick labels for extra coolness

        #        self.plot.set_xlim(self.tList[-2], self.tList[0])
        self.x_ax.set_xlim(self.tList[-2], self.tList[0])
        self.x_ax.xaxis.set_major_locator(mticker.MaxNLocator(nbins=4))

        self.plot.fill_between(
            self.tList,
            self.
            incoming_data,  #where=(self.incoming_data > [0]*len(self.incoming_data))
            facecolor=self.plot_color,
            edgecolor=self.plot_color,
            alpha=0.5)  #blue @initilization


most_recent = reader.get_timeset(table="SensorData", num=20)
#print("most recent", most_recent)
reader.commit()
for i, param in enumerate(param_list, 1):
    tList = []
    most_recent_20 = []
    for j in range(len(most_recent)):
        time_f = datetime.strptime(most_recent[j][0], "%m/%d/%Y %H:%M:%S")
        tList.append(time_f)
        most_recent_20.append(most_recent[j][i])

    subplot = f.add_subplot(6, 2, i)  #sharex?
    x_ax = f.get_axes()
    current_plot = Sensor_Plot(subplot, tList, x_ax[i - 1], param,
                               most_recent_20, 'b')
    param_dict[param] = current_plot
Example #4
0
            ax.xaxis_date()
            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):