Skip to content

Fix time series display range being affected by invisible plots #9353

New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Merged
merged 2 commits into from
Mar 31, 2025
Merged
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
37 changes: 24 additions & 13 deletions crates/viewer/re_view_time_series/src/view_class.rs
Original file line number Diff line number Diff line change
Expand Up @@ -719,20 +719,31 @@ fn add_series_to_plot(
*scalar_range.end_mut() = f64::NEG_INFINITY;

for series in all_plot_series {
let points = series
.points
.iter()
.map(|p| {
if p.1 < scalar_range.start() {
*scalar_range.start_mut() = p.1;
}
if p.1 > scalar_range.end() {
*scalar_range.end_mut() = p.1;
}
let points = if series.visible {
series
.points
.iter()
.map(|p| {
if p.1 < scalar_range.start() {
*scalar_range.start_mut() = p.1;
}
if p.1 > scalar_range.end() {
*scalar_range.end_mut() = p.1;
}

[(p.0 - time_offset) as _, p.1]
})
.collect::<Vec<_>>();
[(p.0 - time_offset) as _, p.1]
})
.collect::<Vec<_>>()
} else {
// TODO(emilk/egui_plot#92): Note we still need to produce a series, so it shows up in the legend.
// As of writing, egui_plot gets confused if this is an empty series, so
// we still add a single point (but don't have it influence the scalar range!)
series
.points
.first()
.map(|p| vec![[(p.0 - time_offset) as _, p.1]])
.unwrap_or_default()
};

let color = series.color;

Expand Down
Loading