MCPcopy Create free account
hub / github.com/donkeyteethUX/iced_plot / PlotWidget

Class PlotWidget

src/plot_widget.rs:57–111  ·  view source on GitHub ↗

A plot widget that renders data series with interactive features.

Source from the content-addressed store, hash-verified

55
56/// A plot widget that renders data series with interactive features.
57pub struct PlotWidget {
58 pub(crate) instance_id: u64,
59 // Data
60 pub(crate) series: IndexMap<ShapeId, Series>,
61 pub(crate) fills: IndexMap<ShapeId, Fill>,
62 pub(crate) vlines: IndexMap<ShapeId, VLine>,
63 pub(crate) hlines: IndexMap<ShapeId, HLine>,
64 pub(crate) hidden_shapes: HashSet<ShapeId>,
65 pub(crate) data_version: u64,
66 // Configuration
67 pub(crate) autoscale_on_updates: bool,
68 pub(crate) controls: PlotControls,
69 pub(crate) highlight_on_hover: bool,
70 pub(crate) show_controls_help: bool,
71 pub(crate) legend_enabled: bool,
72 pub(crate) legend_collapsed: bool,
73 pub(crate) x_axis_label: String,
74 pub(crate) y_axis_label: String,
75 pub(crate) x_lim: Option<(f64, f64)>,
76 pub(crate) y_lim: Option<(f64, f64)>,
77 /// Follow mode: automatically scale Y-axis on each data update.
78 /// X remains under user control (pan/zoom is preserved).
79 pub(crate) autoscale_y_on_updates: bool,
80 /// Follow mode: locks camera X to the right edge (data_max.x) on each data update.
81 /// Zoom level (half_extents.x) is preserved — user can zoom in/out.
82 pub(crate) follow_right_edge: bool,
83 pub(crate) follow_reset_counter: u64,
84 pub(crate) x_axis_scale: AxisScale,
85 pub(crate) y_axis_scale: AxisScale,
86 pub(crate) x_axis_link: Option<AxisLink>,
87 pub(crate) y_axis_link: Option<AxisLink>,
88 pub(crate) hover_radius_px: f32,
89 pub(crate) pick_highlight_provider: Option<HighlightPointProvider>,
90 pub(crate) hover_highlight_provider: Option<HighlightPointProvider>,
91 pub(crate) cursor_overlay: bool,
92 pub(crate) cursor_provider: Option<CursorProvider>,
93 pub(crate) crosshairs_enabled: bool,
94 pub(crate) render_strategy: PlotRenderStrategy,
95 pub(crate) controls_overlay_open: bool,
96 #[cfg(feature = "canvas")]
97 pub(crate) canvas_caches: crate::plot_renderer::canvas::CanvasCaches,
98 pub(crate) x_axis_formatter: Option<TickFormatter>,
99 pub(crate) y_axis_formatter: Option<TickFormatter>,
100 pub(crate) x_tick_producer: Option<TickProducer>,
101 pub(crate) y_tick_producer: Option<TickProducer>,
102 pub(crate) tick_label_size: f32,
103 pub(crate) axis_label_size: f32,
104 pub(crate) data_aspect: Option<f64>,
105 pub(crate) style: StyleFn,
106 pub(crate) resolved_style: RwLock<PlotStyle>,
107 // UI state
108 /// Map of picked point id to highlight point data & tooltip text.
109 pub(crate) picked_points: IndexMap<PointId, (HighlightPoint, Option<TooltipUiPayload>)>,
110 /// Map of hovered point id to highlight point data & tooltip text.
111 pub(crate) hovered_points: IndexMap<PointId, (HighlightPoint, Option<TooltipUiPayload>)>,
112 pub(crate) cursor_ui: Option<CursorPositionUiPayload>,
113 pub(crate) x_ticks: Vec<PositionedTick>,
114 pub(crate) y_ticks: Vec<PositionedTick>,

Callers

nothing calls this directly

Calls

no outgoing calls

Tested by

no test coverage detected