def regen_plot(self): scalingMap = self.scaling_map graphContainer = self.ids.graphcontainer graphContainer.clear_widgets() graph = AnalogScaler() graphContainer.add_widget(graph) plot = LinePlot(color=rgb('00FF00'), line_width=1.25) graph.add_plot(plot) self.plot = plot points = [] map_size = self.map_size max_scaled = None min_scaled = None for i in range(map_size): volts = scalingMap.getVolts(i) scaled = scalingMap.getScaled(i) points.append((volts, scaled)) if max_scaled == None or scaled > max_scaled: max_scaled = scaled if min_scaled == None or scaled < min_scaled: min_scaled = scaled graph.ymin = min_scaled graph.ymax = max_scaled graph.xmin = 0 graph.xmax = 5 plot.points = points
def _regen_plot_interpolated(self, volts, scaled): graphContainer = self.ids.graphcontainer graphContainer.clear_widgets() graph = AnalogScaler() graphContainer.add_widget(graph) plot = LinePlot(color=rgb('00FF00'), line_width=1.25) graph.add_plot(plot) self.plot = plot points = [] max_scaled = None min_scaled = None for i in range(ScalingMap.SCALING_MAP_POINTS): v = volts[i] s = scaled[i] points.append((v, s)) if max_scaled == None or s > max_scaled: max_scaled = s if min_scaled == None or s < min_scaled: min_scaled = s graph.ymin = min_scaled graph.ymax = max_scaled graph.xmin = 0 graph.xmax = 5 plot.points = points