@@ -308,7 +308,8 @@ impl MyApp {
308308 let panel_height = ui. available_size ( ) . y ;
309309 let height = ui. available_size ( ) . y * self . plot_serial_display_ratio ;
310310 let plots_height = height;
311- let plot_height = plots_height / ( self . serial_devices . number_of_plots as f32 ) ;
311+ let plot_height =
312+ plots_height / ( self . serial_devices . number_of_plots [ self . device_idx ] as f32 ) ;
312313 let spacing = 5.0 ;
313314 let width = ui. available_size ( ) . x - 2.0 * border - RIGHT_PANEL_WIDTH ;
314315
@@ -339,7 +340,7 @@ impl MyApp {
339340 let t_fmt = |x, _range : & RangeInclusive < f64 > | format ! ( "{:4.2} s" , x) ;
340341
341342 let plots_ui = ui. vertical ( |ui| {
342- for graph_idx in 0 ..self . serial_devices . number_of_plots {
343+ for graph_idx in 0 ..self . serial_devices . number_of_plots [ self . device_idx ] {
343344 if graph_idx != 0 {
344345 ui. separator ( ) ;
345346 }
@@ -682,15 +683,15 @@ impl MyApp {
682683
683684 ui. horizontal ( |ui| {
684685 if ui. button ( "<" ) . clicked ( ) {
685- self . serial_devices . number_of_plots =
686- ( self . serial_devices . number_of_plots - 1 ) . clamp ( 1 , 10 ) ;
686+ self . serial_devices . number_of_plots [ self . device_idx ] =
687+ ( self . serial_devices . number_of_plots [ self . device_idx ] - 1 ) . clamp ( 1 , 10 ) ;
687688 }
688- ui. add ( egui:: DragValue :: new ( & mut self . serial_devices . number_of_plots )
689+ ui. add ( egui:: DragValue :: new ( & mut self . serial_devices . number_of_plots [ self . device_idx ] )
689690 . clamp_range ( 1 ..=10 ) )
690691 . on_hover_text ( "Select the number of plots to be shown." ) ;
691692 if ui. button ( ">" ) . clicked ( ) {
692- self . serial_devices . number_of_plots =
693- ( self . serial_devices . number_of_plots + 1 ) . clamp ( 1 , 10 ) ;
693+ self . serial_devices . number_of_plots [ self . device_idx ] =
694+ ( self . serial_devices . number_of_plots [ self . device_idx ] + 1 ) . clamp ( 1 , 10 ) ;
694695 }
695696 } ) ;
696697
0 commit comments