class ChartThrottle(Graph): poin = ListProperty([]) xlabel = StringProperty("") ylabel = StringProperty("") x_ticks_minor = NumericProperty(0) x_ticks_major = NumericProperty(10) y_ticks_major = NumericProperty(10) y_ticks_minor = NumericProperty(2) y_grid_label = BooleanProperty(True) x_grid_label = BooleanProperty(False) x_grid = BooleanProperty(False) y_grid = BooleanProperty(True) xmin = NumericProperty(0) xmax = NumericProperty(50) ymin = NumericProperty(0) ymax = NumericProperty(100) label_options = DictProperty({'color': [0, 1, 1, 1], 'bold': False}) border_color = ListProperty([0, 1, 1, .1]) tick_color = ListProperty([1, 1, 1, 1]) plot_pressure = LinePlot(color=[1, 0, 0, 1], line_width=1.5) plot_batt = LinePlot(color=[1, 1, 0, 1], line_width=1.5) plot_pressure.points = [(0, 0)] plot_batt.points = [(0, 0)] def __init__(self, *args, **kwargs): super(ChartThrottle, self).__init__(*args, **kwargs) self.add_plot(self.plot_pressure) self.add_plot(self.plot_batt)
def __init__(self): super(TestGUI, self).__init__() #Window.clearcolor = (1, 1, 1, 1) Window.clearcolor = (.14, .18, .2, 1) self.ser = serial.Serial() self.ser.port = '/dev/ttyUSB0' self.ser.baudrate = 115200 self.setpoint_plot = LinePlot(line_width=2.5, color=[0, 1, 0.8, 1]) self.act_pos_plot = LinePlot(line_width=2.5, color=[0, 1, 0.8, 1]) self.ids.pos_graph.add_plot(self.setpoint_plot) self.ids.pos_graph.add_plot(self.act_pos_plot) self.setpoint_plot.color = [0, 1, 0.8, 1] self.act_pos_plot.color = [0.2196, 0.6431, 0.8, 1] self.graph_clock = Clock.schedule_interval(self.get_plot_points, (1 / 100)) self.graph_clock.cancel() self.slider_clock = Clock.schedule_interval(self.pid_listener, (1 / 10)) self.q = Queue() self.dt = 0 self.ts = Queue() self.maxt = 1000 self.tdata = [0] self.ydata = [0]
def __init__(self, **kwargs): super().__init__(**kwargs) self.plot1 = LinePlot(color=[1., 0.65, 0., 1], line_width=1) self.plot2 = LinePlot(color=[1., 1., 0., 1], line_width=1) self.plot = LinePlot(color=[0., 0.29, 0.49, 1], line_width=3) self.__time = 0 self.dt = 1 / 50000 self.space = np.linspace(0, 1, 1000)
def __init__(self, **kw): super(TEMPERATURE, self).__init__(**kw) self.graph_1 = LinePlot(line_width=1.2, color=[.62, .93, .25, 1]) self.graph_2 = LinePlot(line_width=1.2, color=[.31, .42, .96, 1]) self.graph_3 = LinePlot(line_width=1.2, color=[.96, .46, .21, 1]) self.ids.graph.add_plot(self.graph_1) self.ids.graph.add_plot(self.graph_2) self.ids.graph.add_plot(self.graph_3)
def __init__(self, **kwargs): super().__init__(**kwargs) self.orientation = 'vertical' self.plot_pressure = LinePlot(color=[1, 0, 0, 1], line_width=2) self.plot_flow = LinePlot(color=[1, 0, 0, 1], line_width=2) self.plot_volume = LinePlot(color=[1, 0, 0, 1], line_width=2) self.data = {'time': [], 'pressure': [], 'flow': [], 'volume': []} threading.Thread(target=self.generate_data, daemon=True).start() self.start()
def __init__(self, **kwargs): super(TidalVolume, self).__init__(**kwargs) self.tidalVolume = LinePlot(line_width=1.5, color=[0, 0, 1, 1]) self.oldtidalVolume = LinePlot(line_width=1, color=[0, 0, 1, 0.2]) self.add_plot(self.tidalVolume) self.add_plot(self.oldtidalVolume) self.ymax = 400 self.ymin = 0 self.xmax = graphTime Clock.schedule_interval(self.get_value, 0.001)
def __init__(self, **kwargs): super().__init__(**kwargs) self.plot = LinePlot(color=[0., 0.29, 0.49, 1], line_width=2) self.sep = LinePlot(color=[1, 0, 0, 1], line_width=4) self.__time = 0 self.dt = 1 / 50000 self.omega = 2 * np.pi * self.frequency self.x1 = np.linspace(-2, 0, 1000) self.x2 = np.linspace(0, 2, 1000) self.xtot = np.concatenate([self.x1, self.x2])
def __init__(self, **kwargs): super(PeakPressure, self).__init__(**kwargs) self.peakPressure = LinePlot(line_width=1.5, color=[1, 0, 0, 1]) self.oldpeakPressure = LinePlot(line_width=1, color=[1, 0, 0, 0.2]) self.add_plot(self.peakPressure) self.add_plot(self.oldpeakPressure) self.ymax = 50 self.ymin = 0 self.xmax = graphTime Clock.schedule_interval(self.get_value, 0.001)
def change_points_over_time(self, graph): if self.plot_sys is not None and self.plot_dia is not None: graph.remove_plot(self.plot_dia) graph.remove_plot(self.plot_sys) dia_points = [] sys_points = [] if self.patient == 'Patient 1': patient1 = self.call_api('1') for x in range(patient1.get_timeStampsLength()): dia_points.append((x, patient1.get_diastolic(x))) sys_points.append((x, patient1.get_systolic(x))) elif self.patient == 'Patient 2': patient2 = self.call_api('2') for x in range(patient2.get_timeStampsLength()): dia_points.append((x, patient2.get_diastolic(x))) sys_points.append((x, patient2.get_systolic(x))) elif self.patient == 'Patient 3': patient3 = self.call_api('3') for x in range(patient3.get_timeStampsLength()): dia_points.append((x, patient3.get_diastolic(x))) sys_points.append((x, patient3.get_systolic(x))) elif self.patient == 'Patient 4': patient4 = self.call_api('4') for x in range(patient4.get_timeStampsLength()): dia_points.append((x, patient4.get_diastolic(x))) sys_points.append((x, patient4.get_systolic(x))) elif self.patient == 'Bob E Smith': patient5 = self.call_api('5') for x in range(patient5.get_timeStampsLength()): dia_points.append((x, patient5.get_diastolic(x))) sys_points.append((x, patient5.get_systolic(x))) else: patient6 = self.call_api('6') for x in range(patient6.get_timeStampsLength()): dia_points.append((x, patient6.get_diastolic(x))) sys_points.append((x, patient6.get_systolic(x))) self.plot_dia = LinePlot(color=[1, 0, 0, 1]) self.plot_sys = LinePlot(color=[1, 0, 0, 1]) self.plot_dia.points = dia_points self.plot_sys.points = sys_points graph.add_plot(self.plot_dia) graph.add_plot(self.plot_sys)
def __init__(self, **kwargs): super(TemperatureGraph, self).__init__(**kwargs) plot = LinePlot(color=ORANGE) plot.points = state.temp_history.points self.add_plot(plot) self.temp_plot = plot plot = LinePlot(color=GREEN) plot.points = state.temp_history.points self.add_plot(plot) self.target_temp_plot = plot Clock.schedule_interval(self.update, UPDATE_INTERVAL)
def __init__(self, **kwargs): super(RespiratoryRate, self).__init__(**kwargs) self.respirationRate = LinePlot(line_width=1.5, color=[0, 0.5, 0, 1]) self.oldrespirationRate = LinePlot(line_width=1, color=[0, 0.5, 0, 0.2]) self.add_plot(self.respirationRate) self.add_plot(self.oldrespirationRate) self.ymax = 60 self.ymin = -60 self.xmax = graphTime Clock.schedule_interval(self.get_value, 0.001) get_level_thread = Thread(target=get_data) get_level_thread.daemon = True get_level_thread.start()
def on_graph(self, instance, value): super(WaveDACPlot, self).on_graph(instance, value) self.graph.ylabel = 'Amplitude (V)' self.plot = LinePlot(color=(0.75, 0.4, 0.4, 1.0)) self.plot.line_width = 2 self.plot.points = zip(self.x_points, self.y_points) self.graph.add_plot(self.plot)
def addGraph(self,datapoint,xData,yData,dt): points = [t for t in zip((xData).astype(int),yData)]; ymin = int(min(yData)) ymax = int(max(yData)) xmin = int(min(xData)) xmax = int(max(xData)) if self.setMinMax : if self.ids.graph.ymin > ymin: self.ids.graph.ymin = ymin if self.ids.graph.ymax < ymax: self.ids.graph.ymax = ymax if self.ids.graph.xmin > xmin: self.ids.graph.xmin = xmin if self.ids.graph.xmax < xmax: self.ids.graph.xmax = xmax else: self.ids.graph.ymin = ymin self.ids.graph.ymax = ymax self.ids.graph.xmin = xmin self.ids.graph.xmax = xmax self.setMinMax = True plot = LinePlot(color=self.color) plot.points = points self.ids.graph.add_plot(plot) index = random.randint(0,3) btn1 = ToggleButton(text=datapoint,background_color=self.color) btn1.bind(state=partial(self.on_press,datapoint)) cp = ColorPicker(color=self.color) cp.bind(color=partial(self.on_color,datapoint)) self.plotdata[datapoint] = {'color':self.color,'button':btn1,'plot':plot,'colorpick':cp,'points':points} self.color[index]=self.color[index] - (random.random()); self.ids.hBox.add_widget(btn1) self.ids.hBoxColor.add_widget(cp)
class PsiScreen(Screen): graph = Graph(xlabel=' ', ylabel='', x_ticks_minor=5, x_ticks_major=0, y_ticks_major=10, y_ticks_minor=2, y_grid_label=True, x_grid_label=False, padding=5, x_grid=True, y_grid=True, xmin=-0, xmax=50, ymin=0, ymax=100, label_options={ 'color': [0, 1, 1, 1], 'bold': False }, border_color=[0, 1, 1, .1], tick_color=[1, 1, 1, 1]) plot = LinePlot(color=[1, 0, 0, 1], line_width=1.5) plot.points = [(0, 0)] graph.add_plot(plot) clock = Clock def __init__(self, *args, **kwargs): super(PsiScreen, self).__init__(*args, **kwargs) self.ids["flt"].add_widget(self.graph)
def __init__(self, **kwargs): super().__init__(**kwargs) self.plot = LinePlot(color=[0., 0.29, 0.49, 1], line_width=3) self.t = np.linspace(0, 2, 1000) self.range = [] self.__even = range(3, self.N, 2) self.__odd = range(2, self.N, 2) self.__all = range(2, self.N)
def change_points(self, graph): if self.plot_hor is not None and self.plot_vert is not None: graph.remove_plot(self.plot_hor) graph.remove_plot(self.plot_vert) x = 0 y = 0 if self.patient == 'Patient 1': patient1 = self.call_api('1') x = patient1.get_diastolic(patient1.get_timeStampsLength() - 1) y = patient1.get_systolic(patient1.get_timeStampsLength() - 1) elif self.patient == 'Patient 2': patient2 = self.call_api('2') x = patient2.get_diastolic(patient2.get_timeStampsLength() - 1) y = patient2.get_systolic(patient2.get_timeStampsLength() - 1) elif self.patient == 'Patient 3': patient3 = self.call_api('3') x = patient3.get_diastolic(patient3.get_timeStampsLength() - 1) y = patient3.get_systolic(patient3.get_timeStampsLength() - 1) elif self.patient == 'Patient 4': patient4 = self.call_api('4') x = patient4.get_diastolic(patient4.get_timeStampsLength() - 1) y = patient4.get_systolic(patient4.get_timeStampsLength() - 1) elif self.patient == 'Bob E Smith': patient5 = self.call_api('5') x = patient5.get_diastolic(patient5.get_timeStampsLength() - 1) y = patient5.get_systolic(patient5.get_timeStampsLength() - 1) else: patient6 = self.call_api('6') x = patient6.get_diastolic(patient6.get_timeStampsLength() - 1) y = patient6.get_systolic(patient6.get_timeStampsLength() - 1) p1 = (x, 0) p2 = (x, y) p3 = (0, y) self.plot_hor = LinePlot(color=[0, 0, 0, 1]) self.plot_vert = LinePlot(color=[0, 0, 0, 1]) self.plot_hor.points = [p1, p2] self.plot_vert.points = [p2, p3] graph.add_plot(self.plot_hor) graph.add_plot(self.plot_vert) print(self.patient, x, y)
def __init__(self): super(AccelerometerDemo, self).__init__() self.sensorEnabled = False self.graph = self.ids.graph_plot # For all X, Y and Z axes self.plot = [] self.plot.append(LinePlot(color=[1, 0, 0, 1], line_width=3)) # X - Red self.plot.append(LinePlot(color=[0, 1, 0, 1], line_width=3)) # Y - Green self.plot.append(LinePlot(color=[0, 0, 1, 1], line_width=3)) # Z - Blue self.reset_plots() for plot in self.plot: self.graph.add_plot(plot)
def __init__(self, **kwargs): super(PowerGraph, self).__init__(**kwargs) plot = LinePlot(color=BLUE) plot.points = state.power_history.points self.add_plot(plot) self.plot = plot Clock.schedule_interval(self.update, UPDATE_INTERVAL)
def on_color(self,datapoint,instance, value): self.plotdata[datapoint]['color'] = value # print(datapoint+":RGBA = "+ str(value)) self.plotdata[datapoint]['plot'].color = value # self.plotdata[datapoint]['plot'].draw() self.ids.graph.remove_plot(self.plotdata[datapoint]['plot']) points = self.plotdata[datapoint]['points'] self.plotdata[datapoint]['plot'] = LinePlot(color=value) self.plotdata[datapoint]['plot'].points = points self.plotdata[datapoint]['points'] = points self.plotdata[datapoint]['button'].background_color = value self.ids.graph.add_plot(self.plotdata[datapoint]['plot'])
class ChartPressure(Graph): poin = ListProperty([]) xlabel = StringProperty("") ylabel = StringProperty("") x_ticks_minor = NumericProperty(0) x_ticks_major = NumericProperty(10) y_ticks_major = NumericProperty(10) y_ticks_minor = NumericProperty(2) y_grid_label = BooleanProperty(True) x_grid_label = BooleanProperty(False) x_grid = BooleanProperty(False) y_grid = BooleanProperty(True) xmin = NumericProperty(0) xmax = NumericProperty(50) ymin = NumericProperty(0) ymax = NumericProperty(100) label_options = DictProperty({'color': [0, 1, 1, 1], 'bold': False}) border_color = ListProperty([0, 1, 1, .1]) tick_color = ListProperty([1, 1, 1, 1]) plot_pressure = LinePlot(color=[1, 0, 0, 1], line_width=1.5) plot_batt = LinePlot(color=[1, 1, 0, 1], line_width=1.5) plot_pressure.points = [(0, 0)] plot_batt.points = [(0, 0)] def __init__(self, *args, **kwargs): super(ChartPressure, self).__init__(*args, **kwargs) self.add_plot(self.plot_pressure) self.add_plot(self.plot_batt) def show_chart_pressure(self, x_value, y_value): self.plot_pressure.points.append((x_value, y_value)) if x_value > 50: self.xmax += 1 self.xmin += 1 # self.plot_pressure.points.remove(self.plot_pressure.points[0]) if x_value > 55: self.plot_pressure.points.remove(self.plot_pressure.points[0]) def show_chart_batt(self, x_value, y_value): self.plot_batt.points.append((x_value, y_value))
def on_graph_hr(self, instance, value): self.graph_hr.label_options['color'] = 0, 0, 0, 1 self.graph_hr.label_options['bold'] = True self.graph_hr.xlabel = "Time [s]" self.graph_hr.ylabel = "Heart Rate [bpm]" self.graph_hr.x_ticks_major = 5 # x ticks major value self.graph_hr.x_ticks_minor = 1 # x ticks minor value self.graph_hr.x_grid_label = True # grid on x axis self.graph_hr.y_ticks_major = 10 # x ticks major value self.graph_hr.y_ticks_minor = 5 # x ticks minor value self.graph_hr.y_grid_label = True # grid on y axis self.plot_hr = LinePlot(color=[0, 0, 0, 1.0]) self.plot_hr.line_width = 1
def on_graph_signal(self, instance, value): self.graph_signal.label_options['color'] = 0, 0, 0, 1 self.graph_signal.label_options['bold'] = True self.graph_signal.xlabel = "Time [s]" self.graph_signal.ylabel = "Amplitude [V]" self.graph_signal.x_ticks_major = 5 # x ticks major value self.graph_signal.x_ticks_minor = 1 # x ticks minor value self.graph_signal.x_grid_label = True # grid on x axis self.graph_signal.y_ticks_major = 0.5 # y ticks major value self.graph_signal.y_ticks_minor = 0.5 # y ticks minor value self.graph_signal.y_grid_label = True # grid on x axis self.sample_rate = 995 # 1000 samples per second self.plot = LinePlot(color=[0, 0, 0, 1.0]) self.plot.line_width = 1 self.plot2 = MeshStemPlot(color=[1, 0, 0, 1.0])
def __init__(self,**kwargs): self.color=kwargs.pop('color',[1,1,1,1]) self.line_width=kwargs.pop('line_width',1) self.draw_border=True self.y_grid_label=True self.x_grid_label=False self.padding=5 self.x_grid=True self.y_grid=True self.xmin=0 if (not self.y_ticks_major): if (self.ymax-self.ymin > 50 ): self.y_ticks_major=10 else: self.y_ticks_major=5 super(ScrollGraph,self).__init__(**kwargs) self.plot=LinePlot(color=self.color,line_width=self.line_width) self.add_plot(self.plot)
def __init__(self, **kwargs): super(case, self).__init__(**kwargs) box = FloatLayout() graph = Graph(xlabel='X', ylabel='Y', x_ticks_minor=5, x_ticks_major=25, y_ticks_major=1, y_grid_label=True, x_grid_label=True, padding=5, x_grid=True, y_grid=True, xmin=-0, xmax=20, ymin=0, ymax=10) plot = LinePlot() # plot.points = [(x, sin(x / 10.)) for x in range(0, 101)] # data = np.array([[0,0], [1,1],[2,2]]) data = collections.deque(maxlen=20) time = collections.deque(maxlen=20) d = (0, 1, 2, 3, 4, 5, 6, 7, 8, 9) t = (0, 1, 2, 3, 4, 5, 6, 7, 8, 9) data.append(d) time.append(t) toplot = np.vstack((time, data)).T print toplot plot.points = tuple(map(tuple, toplot)) graph.add_plot(plot) box.add_widget(graph) self.add_widget(box)
def on_graph(self, instance, value): ''' @brief Callback called when graph object is ready on the UI ''' self.graph.label_options['color'] = 0, 0, 0, 1 self.graph.label_options['bold'] = True self.graph.xlabel = "Time [s]" self.graph.ylabel = "Amplitude [V]" self.graph.x_ticks_major = 5 # x ticks major value self.graph.x_ticks_minor = 1 # x ticks minor value self.graph.x_grid_label = True # grid on x axis self.n_seconds = 3 self.graph.y_ticks_major = 1 # x ticks major value self.graph.y_ticks_minor = 1 # x ticks minor value self.graph.y_grid_label = True # grid on x axis self.graph.xmin = -self.n_seconds self.graph.xmax = 0 self.graph.ymin = 0 self.graph.ymax = 5 self.sample_rate = 1000 # 10 samples per second self.n_points = self.n_seconds * self.sample_rate #self.n_seconds * self.sample_rate # Number of points to plot # Distance between points self.time_between_points = (self.n_seconds) / float(self.n_points) self.plot = LinePlot(color=[0, 0, 0, 1.0]) self.plot.line_width = 1 # Populate lists of points self.x_points = [x for x in range(-self.n_points, 0)] self.y_points = [0 for y in range(-self.n_points, 0)] for j in range(self.n_points): self.x_points[j] = -self.n_seconds + j * self.time_between_points # Zip them and add them to the plot points self.plot.points = zip(self.x_points, self.y_points) self.graph.add_plot(self.plot)
def _onReceive(self, data): genericIndex = 0 data = data.decode('utf-8').rstrip() if self.first: self.first = False self.plotsList = [] self.nPlots = len(data.split(',')) for genericIndex in range(0, self.nPlots): newPlot = LinePlot(line_width=2, color=[random(), random(), random(), 1]) self.widget.graph.add_plot(newPlot) self.plotsList.append(newPlot) self.file.write("Time,") for genericIndex in range(0, self.nPlots): if (genericIndex == self.nPlots - 1): self.file.write("Plot {}\n".format(genericIndex + 1)) else: self.file.write("Plot {},".format(genericIndex + 1)) self.addData(data) self.file.write("{}, {}\n".format(self.widget.elapsedSec, data))
def __init__(self, **kwargs): super(Screen, self).__init__(**kwargs) self.allowed_receive_database = True self.error = Image( source='Img/error.png', allow_stretch=False, keep_ratio=True, pos_hint={"center_x": 0.095, "center_y": 0.64}, size_hint=(0.11, 0.11)) self.wait = Image( source='Img/wait.png', allow_stretch=False, keep_ratio=True, pos_hint={"center_x": 0.095, "center_y": 0.64}, size_hint=(0.11, 0.11)) graph_theme = { 'label_options': { 'color': rgb('444444'), # color of tick labels and titles 'bold': True}, 'background_color': rgb('f8f8f2'), # back ground color of canvas 'tick_color': rgb('808080'), # ticks and grid 'border_color': rgb('808080')} # border drawn around each graph self.graph1 = Graph( xlabel='Time [s]', ylabel='Value', x_ticks_minor=5, x_ticks_major=5, y_ticks_minor=1, y_ticks_major=10, y_grid_label=True, x_grid_label=True, padding=5, xlog=False, ylog=False, x_grid=False, y_grid=False, xmin=0, xmax=30, ymin=0, ymax=100, pos_hint={'center_x': 0.5, 'center_y': 0.5}, _with_stencilbuffer=False, **graph_theme) self.graph2 = Graph( xlabel='Time [s]', ylabel='Value', x_ticks_minor=5, x_ticks_major=5, y_ticks_minor=1, y_ticks_major=1, y_grid_label=True, x_grid_label=True, padding=5, xlog=False, ylog=False, x_grid=False, y_grid=False, xmin=0, xmax=30, ymin=-5, ymax=5, pos_hint={'center_x': 0.5, 'center_y': 0.5}, _with_stencilbuffer=False, **graph_theme) self.plot1 = LinePlot(line_width=2, color=[1, 0, 0, 1]) self.plot1.points = [(i, j*10/3) for i, j in enumerate(range(31))] self.graph1.add_plot(self.plot1) self.ids.panel1.add_widget(self.graph1) self.plot2 = LinePlot(line_width=2, color=[1, 0, 0, 1]) self.plot2.points = [(i, j/3 - 5) for i, j in enumerate(range(31))] self.graph2.add_plot(self.plot2) self.ids.panel2.add_widget(self.graph2)
def __init__(self, **kwargs): super().__init__(**kwargs) self.plot1 = LinePlot(color=[1., 0.65, 0., 1], line_width=1) self.plot2 = LinePlot(color=[1., 1., 0., 1], line_width=1) self.plot = LinePlot(color=[0., 0.29, 0.49, 1], line_width=3)
def build(self): availablePorts = listSerialPorts() self.connection = serial.Serial(availablePorts[0], 115200) self.counter = 1 self.runState = False self.enableCO2 = False layoutMain = BoxLayout(orientation='horizontal',spacing=0, padding=0) layoutLeft = BoxLayout(orientation='vertical', spacing=0, padding=0) # Graphing area layoutGraph = BoxLayout(orientation='vertical', spacing=0, padding=(5,0)) graphPaw = ScrollGraph(ylabel='Paw cmH2O', draw_border=True, y_ticks_major=5, y_grid_label=True, x_grid_label=False, padding=5, x_grid=True, y_grid=True, xmin=0, xmax=600, ymin=0, ymax=20) graphFlow = ScrollGraph(ylabel='Flow L/min', draw_border=True, y_ticks_major=20, y_grid_label=True, x_grid_label=False, padding=5, x_grid=True, y_grid=True, xmin=0, xmax=600, ymin=-60, ymax=60) graphVt = ScrollGraph(ylabel='Vt mL', draw_border=True, y_ticks_major=10, y_grid_label=True, x_grid_label=False, padding=5, x_grid=True, y_grid=True, xmin=0, xmax=600, ymin=0, ymax=40) if (self.enableCO2): graphCO2 = ScrollGraph(ylabel='CO2 mmHg', draw_border=True, y_ticks_major=10, y_grid_label=True, x_grid_label=False, padding=5, x_grid=True, y_grid=True, xmin=0, xmax=600, ymin=0, ymax=40,size_hint_y=0,) self.plot = [] self.plot.append(LinePlot(color=[1, 0, 1, 1],line_width=1)) self.plot.append(LinePlot(color=[0, 1, 1, 1],line_width=1)) self.plot.append(LinePlot(color=[1, 1, 0, 1],line_width=1)) if (self.enableCO2): self.plot.append(LinePlot(color=[0.5, 0.5, 1, 1],line_width=1)) self.reset_plots() graphPaw.add_plot(self.plot[0]) graphFlow.add_plot(self.plot[1]) graphVt.add_plot(self.plot[2]) if (self.enableCO2): graphCO2.add_plot(self.plot[3]) layoutGraph.add_widget(graphPaw) layoutGraph.add_widget(graphFlow) layoutGraph.add_widget(graphVt) if (self.enableCO2): layoutGraph.add_widget(graphCO2) #self.graphCO2.height='0dp' #self.graphCO2.size_hint_y=0 layoutLeft.add_widget(layoutGraph) # Bottom Controls layoutControlBottom = BoxLayout(orientation='horizontal', spacing=10, padding=(5,10),size_hint=(1,0.2)) buttonMode = SelectButton(name='mode',text_top="Mode",value="PCV-VG",values=('PCV-VG','PCV'),text_bottom=" ") layoutControlBottom.add_widget(buttonMode); buttonTidalVolume = SliderButton(name='tidalv',text_top="TidalV",min=200,max=800,value=500,text_bottom="ml"); layoutControlBottom.add_widget(buttonTidalVolume); buttonRespRate = SliderButton(name='rate',text_top="Rate",min=8,max=40,value=18,text_bottom="/min"); layoutControlBottom.add_widget(buttonRespRate); buttonInhaleExhale = SelectButton(name='ie',text_top="I:E",value="1:2",values=('1:1','1:2','1:3','1:4'),text_bottom=" "); layoutControlBottom.add_widget(buttonInhaleExhale); buttonPEEP = SliderButton(name='peep',text_top="PEEP",min=0,value="5",max=25,text_bottom="cmH2O"); layoutControlBottom.add_widget(buttonPEEP); buttonPressureMax = SliderButton(name='pmax',text_top="Pmax",min=10,value="20",max=60,text_bottom="cmH2O"); layoutControlBottom.add_widget(buttonPressureMax); layoutLeft.add_widget(layoutControlBottom) layoutMain.add_widget(layoutLeft) # Right Controls layoutControlRight = BoxLayout(orientation='vertical', spacing=10, padding=(10,5),size_hint=(0.2,1)) buttonAlarmPause = RotaryButton(name='alarm',text_top='Alarm Status',value="Silenced",values={'Normal','Alarm','Silenced'},value_colors={'Normal':(0.3,1,0.3,1),'Silenced':(1,1,0.3,1),'Alarm':(1,0.3,0.3,1)}); layoutControlRight.add_widget(buttonAlarmPause); buttonAlarmSetup = DisplayButton(value="Alarm\nSetup"); layoutControlRight.add_widget(buttonAlarmSetup); buttonSystemSetup = DisplayButton(value="System\nSetup"); layoutControlRight.add_widget(buttonSystemSetup); self.buttonRun = RotaryButton(name='status',text_top="Status",on_press=self.runButton,value="Stopped",values=('Stopped','Running'),value_colors={'Stopped':(1,0.3,0.3,1),'Running':(0.3,1,0.3,1)}) layoutControlRight.add_widget(self.buttonRun) layoutMain.add_widget(layoutControlRight) return layoutMain
def __init__(self, **kw): super(SCREEN, self).__init__(**kw) self.graph = LinePlot(line_width=1.2, color=[.62, .93, .25, 1]) self.ids.graph.add_plot(self.graph)