#![allow(clippy::unwrap_used)]
mod aggregation;
mod line_visualizer_system;
mod point_visualizer_system;
mod space_view_class;
mod util;
use re_log_types::EntityPath;
use re_types::components::{AggregationPolicy, MarkerShape};
pub use space_view_class::TimeSeriesSpaceView;
#[inline]
pub(crate) fn plot_id(space_view_id: re_viewer_context::SpaceViewId) -> egui::Id {
egui::Id::new(("plot", space_view_id))
}
#[derive(Clone, Debug)]
pub struct PlotPointAttrs {
pub color: egui::Color32,
pub radius_ui: f32,
pub kind: PlotSeriesKind,
}
#[derive(Clone, Copy, Default, Debug, PartialEq, Eq)]
pub struct ScatterAttrs {
pub marker: MarkerShape,
}
impl PartialEq for PlotPointAttrs {
fn eq(&self, rhs: &Self) -> bool {
let Self {
color,
radius_ui,
kind,
} = self;
color.eq(&rhs.color) && radius_ui.total_cmp(&rhs.radius_ui).is_eq() && kind.eq(&rhs.kind)
}
}
impl Eq for PlotPointAttrs {}
#[derive(Clone, Debug, PartialEq)]
struct PlotPoint {
time: i64,
value: f64,
attrs: PlotPointAttrs,
}
#[derive(Clone, Copy, Debug, PartialEq, Eq)]
pub enum PlotSeriesKind {
Continuous,
Scatter(ScatterAttrs),
Clear,
}
#[derive(Clone, Debug)]
pub struct PlotSeries {
pub label: String,
pub color: egui::Color32,
pub radius_ui: f32,
pub kind: PlotSeriesKind,
pub points: Vec<(i64, f64)>,
pub entity_path: EntityPath,
pub min_time: i64,
pub aggregator: AggregationPolicy,
pub aggregation_factor: f64,
}