@@ -148,7 +148,7 @@ impl Reaction {
148148 }
149149 }
150150
151- pub fn draw ( & self , plot_ui : & mut egui_plot:: PlotUi < ' _ > , y_offset : f64 ) {
151+ pub fn draw ( & self , plot_ui : & mut egui_plot:: PlotUi < ' _ > , y_offset : f64 , bar_width : f64 ) {
152152 let color = self . color ;
153153
154154 let mut bars = Vec :: new ( ) ;
@@ -157,7 +157,7 @@ impl Reaction {
157157 orientation : Orientation :: Vertical ,
158158 argument : * rho,
159159 value : 0.50 ,
160- bar_width : 0.01 ,
160+ bar_width,
161161 fill : color,
162162 stroke : Stroke :: new ( 1.0 , color) ,
163163 name : format ! ( "E = {:.3} MeV\n rho = {:.3}\n " , * excitation, * rho) ,
@@ -249,6 +249,7 @@ pub struct SPSPlotApp {
249249 sps_angle : f64 ,
250250 beam_energy : f64 ,
251251 magnetic_field : f64 ,
252+ bar_width : f64 ,
252253 rho_min : f64 ,
253254 rho_max : f64 ,
254255 reactions : Vec < Reaction > ,
@@ -263,6 +264,7 @@ impl Default for SPSPlotApp {
263264 sps_angle : 35.0 ,
264265 beam_energy : 16.0 ,
265266 magnetic_field : 8.7 ,
267+ bar_width : 1.0 ,
266268 rho_min : 69.0 ,
267269 rho_max : 87.0 ,
268270 reactions : Vec :: new ( ) ,
@@ -279,6 +281,7 @@ impl SPSPlotApp {
279281 sps_angle : 35.0 , // degree
280282 beam_energy : 16.0 , // MeV
281283 magnetic_field : 8.7 , // kG
284+ bar_width : 1.0 ,
282285 rho_min : 69.0 ,
283286 rho_max : 87.0 ,
284287 reactions : Vec :: new ( ) ,
@@ -349,6 +352,8 @@ impl SPSPlotApp {
349352 ui. separator ( ) ;
350353
351354 ui. checkbox ( & mut self . side_panel , "Show Exciation Levels" ) ;
355+
356+ ui. add ( egui:: Slider :: new ( & mut self . bar_width , 0.01 ..=1.00 ) . text ( "Bar Width" ) ) ;
352357 } ) ;
353358 }
354359
@@ -516,7 +521,7 @@ impl SPSPlotApp {
516521
517522 for ( index, reaction) in self . reactions . iter_mut ( ) . enumerate ( ) {
518523 let y_value = index as f64 + 0.25 ;
519- reaction. draw ( plot_ui, y_value) ;
524+ reaction. draw ( plot_ui, y_value, self . bar_width ) ;
520525 }
521526
522527 plot_ui. set_plot_bounds ( PlotBounds :: from_min_max (
0 commit comments