Skip to content

Commit

Permalink
self-review
Browse files Browse the repository at this point in the history
  • Loading branch information
teh-cmc committed Jan 18, 2024
1 parent 1d383ae commit 3dcab08
Show file tree
Hide file tree
Showing 5 changed files with 21 additions and 34 deletions.
2 changes: 1 addition & 1 deletion crates/re_data_store/examples/range_components.rs
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
//! Demonstrates usage of [`re_data_store::polars_util::range_components`].
//!
//! ```text
//! POLARS_FMT_MAX_ROWS=100 cargo r -p re_data_store --example range_components
//! POLARS_FMT_MAX_ROWS=100 cargo r -p re_data_store --all-features --example range_components
//! ```
use polars_core::prelude::JoinType;
Expand Down
11 changes: 1 addition & 10 deletions crates/re_data_store/src/polars_util.rs
Original file line number Diff line number Diff line change
Expand Up @@ -85,9 +85,6 @@ pub fn latest_components(
/// Iterates over the rows of any number of components and their respective cluster keys, all from
/// the single point-of-view of the `primary` component, returning an iterator of `DataFrame`s.
///
/// An initial dataframe is yielded with the latest-at state at the start of the time range, if
/// there is any.
///
/// The iterator only ever yields dataframes iff the `primary` component has changed.
/// A change affecting only secondary components will not yield a dataframe.
///
Expand Down Expand Up @@ -140,13 +137,7 @@ pub fn range_components<'a, const N: usize>(
join_type,
);

if df.as_ref().map_or(false, |df| {
// We only care about the initial state if it A) isn't empty and B) contains any data
// at all for the primary component.
!df.is_empty() && df.column(primary.as_ref()).is_ok()
}) {
df_latest = Some(df);
}
df_latest = Some(df);
}

let primary_col = components
Expand Down
4 changes: 1 addition & 3 deletions crates/re_query/src/range.rs
Original file line number Diff line number Diff line change
Expand Up @@ -84,9 +84,7 @@ pub fn range_archetype<'a, A: Archetype + 'a, const N: usize>(
.map(|(_, row_id, cwi)| (row_id, cwi));
}

if cwis_latest_raw[primary_col].is_some() {
cwis_latest = Some(cwis_latest_raw);
}
cwis_latest = Some(cwis_latest_raw);
}

// send the latest-at state before anything else
Expand Down
12 changes: 11 additions & 1 deletion crates/re_space_view_time_series/src/visualizer_system.rs
Original file line number Diff line number Diff line change
Expand Up @@ -227,7 +227,17 @@ impl TimeSeriesSystem {
let line_label =
same_label(&points).unwrap_or_else(|| data_result.entity_path.to_string());

self.add_line_segments(&line_label, points);
if points.len() == 1 {
self.lines.push(PlotSeries {
label: line_label,
color: points[0].attrs.color,
width: 2.0 * points[0].attrs.radius,
kind: PlotSeriesKind::Scatter,
points: vec![(points[0].time, points[0].value)],
});
} else {
self.add_line_segments(&line_label, points);
}
}

Ok(())
Expand Down
26 changes: 7 additions & 19 deletions crates/re_viewer/src/ui/visible_history.rs
Original file line number Diff line number Diff line change
Expand Up @@ -246,9 +246,6 @@ fn current_range_ui(
is_sequence_timeline: bool,
visible_history: &VisibleHistory,
) {
let from = visible_history.from(current_time.into());
let to = visible_history.to(current_time.into());

let (time_type, quantity_name) = if is_sequence_timeline {
(TimeType::Sequence, "frame")
} else {
Expand All @@ -260,22 +257,13 @@ fn current_range_ui(
ctx.app_options.time_zone_for_timestamps,
);

if from == to {
ui.label(format!(
"Showing last data logged on or before {quantity_name} {from_formatted}"
));
} else {
ui.label(format!(
"Showing data between {quantity_name}s {from_formatted} and {}.",
time_type.format(
visible_history.to(current_time.into()),
ctx.app_options.time_zone_for_timestamps
)
))
.on_hover_text(format!(
"This includes the data current as of the starting {quantity_name}."
));
};
ui.label(format!(
"Showing data between {quantity_name}s {from_formatted} and {} (included).",
time_type.format(
visible_history.to(current_time.into()),
ctx.app_options.time_zone_for_timestamps
)
));
}

#[allow(clippy::too_many_arguments)]
Expand Down

0 comments on commit 3dcab08

Please sign in to comment.