1
0
Fork 0
mirror of https://github.com/alemidev/scope-tui.git synced 2024-11-23 14:14:48 +01:00

fix: better default spectroscope scale

This commit is contained in:
əlemi 2024-03-18 06:42:54 +01:00
parent 7692cf2475
commit d3e744063e
Signed by: alemi
GPG key ID: A4895B84D311642C

View file

@ -80,7 +80,7 @@ impl DisplayMode for Spectroscope {
Dimension::X => ("frequency -", [20.0f64.ln(), ((cfg.samples as f64 / cfg.width as f64) * 20000.0).ln()]), Dimension::X => ("frequency -", [20.0f64.ln(), ((cfg.samples as f64 / cfg.width as f64) * 20000.0).ln()]),
Dimension::Y => ( Dimension::Y => (
if self.log_y { "| level" } else { "| amplitude" }, if self.log_y { "| level" } else { "| amplitude" },
[if self.log_y { -(cfg.scale * 5.0) } else { 0.0 }, cfg.scale * 5.0] [if self.log_y { 0. } else { 0.0 }, cfg.scale * 7.5] // very arbitrary but good default
), ),
// TODO super arbitraty! wtf! also ugly inline ifs, get this thing together! // TODO super arbitraty! wtf! also ugly inline ifs, get this thing together!
}; };
@ -149,8 +149,8 @@ impl DisplayMode for Spectroscope {
} }
fn references(&self, cfg: &GraphConfig) -> Vec<DataSet> { fn references(&self, cfg: &GraphConfig) -> Vec<DataSet> {
let lower = if self.log_y { -(cfg.scale * 5.) } else { 0. }; let lower = 0.; // if self.log_y { -(cfg.scale * 5.) } else { 0. };
let upper = cfg.scale * 10.; let upper = cfg.scale * 7.5;
vec![ vec![
DataSet::new(None, vec![(0.0, 0.0), ((cfg.samples as f64).ln(), 0.0)], cfg.marker_type, GraphType::Line, cfg.axis_color), DataSet::new(None, vec![(0.0, 0.0), ((cfg.samples as f64).ln(), 0.0)], cfg.marker_type, GraphType::Line, cfg.axis_color),