serial-monitor-rust icon indicating copy to clipboard operation
serial-monitor-rust copied to clipboard

Feature request - Scale per channel

Open usbalbin opened this issue 1 year ago • 3 comments

When having different values with completely different scales, the smaller ones turns in to flat lines close to zero

It would be useful to have individual scaling per channel like on an oscilloscope. Not shure how that would work with y-ranges etc.

image

usbalbin avatar Dec 01 '23 11:12 usbalbin

Indeed a very good idea, this should be implemented! We could have a drop down to select pre-defined gains/scaling factors (..., 0.1, 1, 10, ...) next to the field where you can enter a name for the dataset/curve?

hacknus avatar Dec 02 '23 05:12 hacknus

Perhaps even a "offset" parameter. That, I, believe would be enough to allow scaling and moving around the curves above until they are all evenly spread out and with their respective variations clearly visible.

If one could dream :), there would be two buttons Autoscale and Autoscale side by side(or similar). Where the first button would scale and move all curves to occupy the hole screen. The second button would do the same but put them side by side so as to avoid any overlapping.

usbalbin avatar Dec 02 '23 07:12 usbalbin

Yes, we would definitely require both a scale and offset. Autoscale could also be a possibility and could be easy to implement (not sure though). I think both need to be implemented in line 333 of gui.rs:

for (i, time) in self.data.time[window..].iter().enumerate() {
    let x = *time as f64 / 1000.0;
    for (graph, data) in graphs.iter_mut().zip(&self.data.dataset) {
        if self.data.time.len() == data.len() {
            if let Some(y) = data.get(i + window) {
                graph.push(PlotPoint { x, y: *y as f64 });   // implement offset and scale here
            }
        }
    }
}

Autosacle side by side could be more difficult, there I do not have a clear picture on how one would do this.

hacknus avatar Dec 02 '23 10:12 hacknus