PlotState is a projection of the widget configuration, data, and interaction state. It holds the GPU-ready data needed for rendering the plot. Not part of the public API, but pub visibility is required for the shader implementation.
| 25 | /// |
| 26 | /// Not part of the public API, but pub visibility is required for the shader implementation. |
| 27 | pub struct PlotState { |
| 28 | // Immutable shared data to allow cheap shallow clones. |
| 29 | pub(crate) points: Arc<[Point]>, // vertex/instance data |
| 30 | pub(crate) point_colors: Arc<[Color]>, // per-point colors (matches points) |
| 31 | pub(crate) series: Arc<[SeriesSpan]>, // spans describing logical series |
| 32 | pub(crate) fills: Arc<[FillSpan]>, // triangulated fill spans |
| 33 | pub(crate) vlines: Arc<[VLine]>, // vertical reference lines |
| 34 | pub(crate) hlines: Arc<[HLine]>, // horizontal reference lines |
| 35 | pub(crate) data_min: Option<DVec2>, |
| 36 | pub(crate) data_max: Option<DVec2>, |
| 37 | // Axis limits |
| 38 | pub(crate) x_lim: Option<(f64, f64)>, |
| 39 | pub(crate) y_lim: Option<(f64, f64)>, |
| 40 | pub(crate) x_axis_scale: AxisScale, |
| 41 | pub(crate) y_axis_scale: AxisScale, |
| 42 | // Axis links for synchronization |
| 43 | pub(crate) x_axis_link: Option<AxisLink>, |
| 44 | pub(crate) y_axis_link: Option<AxisLink>, |
| 45 | pub(crate) x_link_version: u64, |
| 46 | pub(crate) y_link_version: u64, |
| 47 | // UI / camera |
| 48 | pub(crate) camera: Camera, |
| 49 | pub(crate) bounds: Rectangle, |
| 50 | pub(crate) x_ticks: Vec<PositionedTick>, |
| 51 | pub(crate) y_ticks: Vec<PositionedTick>, |
| 52 | pub(crate) grid_style: GridStyle, |
| 53 | // Interaction state |
| 54 | pub(crate) cursor_position: Vec2, |
| 55 | pub(crate) last_click_time: Option<Instant>, |
| 56 | pub(crate) last_click_button: Option<mouse::Button>, |
| 57 | pub(crate) legend_collapsed: bool, |
| 58 | pub(crate) modifiers: keyboard::Modifiers, |
| 59 | pub(crate) press: ButtonPressState, |
| 60 | pub(crate) selection: SelectionState, |
| 61 | pub(crate) pan: PanState, |
| 62 | pub(crate) drag: DragState, |
| 63 | /// Hover/select point rendering data (for incremental rendering) |
| 64 | pub(crate) highlighted_points: Arc<[HighlightPoint]>, |
| 65 | // Version counters |
| 66 | pub(crate) markers_version: u64, |
| 67 | pub(crate) lines_version: u64, |
| 68 | pub(crate) fills_version: u64, |
| 69 | pub(crate) highlight_version: u64, |
| 70 | pub(crate) data_src_version: u64, // version of source data last synced |
| 71 | pub(crate) source_instance_id: Option<u64>, |
| 72 | // Hover/picking internals |
| 73 | pub(crate) hover_enabled: bool, |
| 74 | pub(crate) pick_enabled: bool, |
| 75 | pub(crate) hover_radius_px: f32, |
| 76 | pub(crate) picking: PickingState, |
| 77 | pub(crate) crosshairs_enabled: bool, |
| 78 | pub(crate) crosshairs_position: Vec2, |
| 79 | pub(crate) x_axis_formatter: Option<TickFormatter>, |
| 80 | pub(crate) y_axis_formatter: Option<TickFormatter>, |
| 81 | pub(crate) prev_data_max_x: Option<f64>, |
| 82 | pub(crate) follow_reset_seen: u64, |
| 83 | pub(crate) last_point_y: Option<f64>, |
| 84 | pub(crate) prev_last_point_y: Option<f64>, |
nothing calls this directly
no outgoing calls
no test coverage detected