pub struct ScatterView { /* private fields */ }Implementations§
Source§impl ScatterView
impl ScatterView
Sourcepub fn new(render_state: &RenderState, id: PlotId) -> Self
pub fn new(render_state: &RenderState, id: PlotId) -> Self
Create a new scatter-view widget.
Reserves two plot ids: id for the scatter plot and id + 1 for the
line-profile side window (mirroring Plot2D, which reserves a small id
range for its profile window).
Sourcepub fn show_colorbar(&self) -> bool
pub fn show_colorbar(&self) -> bool
Whether the side colorbar column is shown (silx ColorBarAction).
Sourcepub fn set_show_colorbar(&mut self, show: bool)
pub fn set_show_colorbar(&mut self, show: bool)
Show or hide the side colorbar column (silx ColorBarAction). When
hidden, Self::show does not reserve the colorbar column and the
scatter plot fills the freed width.
Sourcepub fn alpha(&self) -> Option<&[f64]>
pub fn alpha(&self) -> Option<&[f64]>
The retained per-point alpha array in [0, 1] (silx Scatter alpha),
or None when no per-point alpha is set.
Sourcepub fn with_alpha(self, alpha: Vec<f64>) -> Self
pub fn with_alpha(self, alpha: Vec<f64>) -> Self
Set the per-point alpha array (silx Scatter.setData(alpha=...),
scatter.py:1051-1060), consumed at construction. Each entry is clamped to
[0, 1]; the array should have one entry per point (the silx contract),
but a length mismatch does not panic — see compose_per_point_alpha.
In ScatterVisualization::Points mode each point’s colormap RGBA alpha
is multiplied by its per-point alpha, with the curve’s global alpha
multiplying on top in-shader (silx three-stage colormap.alpha * per_point.alpha * global.alpha).
Sourcepub fn set_alpha(&mut self, alpha: Vec<f64>)
pub fn set_alpha(&mut self, alpha: Vec<f64>)
Set the per-point alpha array and re-render the current visualization
(silx Scatter.setData(alpha=...)). Each entry is clamped to [0, 1].
See Self::with_alpha for the three-stage alpha composition.
Sourcepub fn clear_alpha(&mut self)
pub fn clear_alpha(&mut self)
Clear any per-point alpha (silx Scatter.setData(alpha=None)) and
re-render, restoring the unscaled colormap RGBA alpha.
Sourcepub fn set_data(
&mut self,
x: &[f64],
y: &[f64],
values: &[f64],
colormap: Colormap,
) -> Result<(), PlotDataError>
pub fn set_data( &mut self, x: &[f64], y: &[f64], values: &[f64], colormap: Colormap, ) -> Result<(), PlotDataError>
Upload data. values drives point colours through colormap.
All three slices must have equal length; returns PlotDataError otherwise.
Sourcepub fn visualization(&self) -> ScatterVisualization
pub fn visualization(&self) -> ScatterVisualization
The active scatter visualization mode (silx Scatter.getVisualization).
Sourcepub fn line_profile(
&self,
start: (f64, f64),
end: (f64, f64),
n_points: usize,
) -> Option<ScatterLineProfile>
pub fn line_profile( &self, start: (f64, f64), end: (f64, f64), n_points: usize, ) -> Option<ScatterLineProfile>
Extract a line profile across the scatter data (silx
ScatterProfileToolBar / _computeProfile, tools/profile/rois.py:737).
Samples n_points evenly along start..end and interpolates each
through the scatter’s Delaunay mesh (silx LinearNDInterpolator, via
crate::core::scatter_viz::scatter_line_profile). Returns the sampled
ScatterLineProfile (positions + interpolated values), or None when
no data has been set or every sample lies outside the convex hull (silx
_computeProfile returns None when nothing is finite). The interactive
line-ROI tool and the side profile plot are not wired (GPU/UI).
Sourcepub fn show_line_profile(
&mut self,
start: (f64, f64),
end: (f64, f64),
n_points: usize,
) -> bool
pub fn show_line_profile( &mut self, start: (f64, f64), end: (f64, f64), n_points: usize, ) -> bool
Sample the line profile start..end (with n_points samples) across the
scatter and show it in the side profile window as a value-vs-distance curve
(silx ScatterProfileToolBar: draw a profile line ROI → the profile window
plots the interpolated profile). Opens the window and returns true when a
profile was produced; returns false (leaving the window untouched) when
there is no data, fewer than 3 non-collinear points, or the whole segment
falls outside the scatter’s convex hull (see Self::line_profile).
Sourcepub fn profile_window(&self) -> &ProfileWindow
pub fn profile_window(&self) -> &ProfileWindow
The line-profile side window (silx ScatterProfileToolBar profile window),
fed by Self::show_line_profile.
Sourcepub fn profile_window_mut(&mut self) -> &mut ProfileWindow
pub fn profile_window_mut(&mut self) -> &mut ProfileWindow
Mutable access to the line-profile side window (e.g. to set its band width / reduction method or to close it).
Sourcepub fn profile_mode(&self) -> bool
pub fn profile_mode(&self) -> bool
Whether the interactive line-profile tool is armed (silx
ScatterProfileToolBar).
Sourcepub fn set_profile_mode(&mut self, enabled: bool)
pub fn set_profile_mode(&mut self, enabled: bool)
Arm or disarm the interactive line-profile tool (silx
ScatterProfileToolBar’s profile ROI). While armed, a primary drag across
the scatter samples a line profile between its data-space endpoints and
shows it in the side window (see Self::show_line_profile).
Arming switches the plot to PlotInteractionMode::Select so the drag
neither pans nor box-zooms (and, with no ROI under the cursor, nothing else
consumes it); disarming restores the default PlotInteractionMode::Zoom,
drops any in-progress drag, and closes the profile window (silx clears the
profile when its tool is deselected).
Sourcepub fn set_visualization(&mut self, mode: ScatterVisualization)
pub fn set_visualization(&mut self, mode: ScatterVisualization)
Set the scatter visualization mode (silx Scatter.setVisualization).
ScatterVisualization::Points shows the marker cloud;
ScatterVisualization::Solid renders the per-vertex-colored Delaunay
triangle surface (built via
crate::core::scatter_viz::solid_triangles); the grid modes render the
retained (x, y, value) points as a colormapped image (built via
scatter_grid_image). Re-renders immediately against the data from the
last Self::set_data.
Sourcepub fn grid_resolution(&self) -> (usize, usize)
pub fn grid_resolution(&self) -> (usize, usize)
The target grid resolution (rows, cols) used by the resolution-driven
grid modes (silx GRID_SHAPE / BINNED_STATISTIC_SHAPE).
Sourcepub fn set_grid_resolution(&mut self, rows: usize, cols: usize)
pub fn set_grid_resolution(&mut self, rows: usize, cols: usize)
Set the target grid resolution (rows, cols) for the resolution-driven
ScatterVisualization::BinnedStatistic mode; ignored by
ScatterVisualization::RegularGrid (auto-detected) and
ScatterVisualization::IrregularGrid (triangle mesh). Re-renders the
current visualization.
Sourcepub fn grid_image(&self) -> Option<GridImage>
pub fn grid_image(&self) -> Option<GridImage>
The grid image produced for the current visualization mode from the
retained points, or None for the non-image modes
(ScatterVisualization::Points, ScatterVisualization::Solid, and
ScatterVisualization::IrregularGrid, which render through the marker
cloud / triangle-mesh paths) / before any data is uploaded / when the
points cannot form a grid.
Exposed so callers (and tests) can inspect the converted grid that
Self::show renders through the image path.
Sourcepub fn colormap(&self) -> Option<&Colormap>
pub fn colormap(&self) -> Option<&Colormap>
The value colormap that drives the marker colors, retained from the last
Self::set_data (silx ScatterView.getColormap). None before any
data has been uploaded.
Sourcepub fn colorbar(&self) -> Option<ColorBarWidget>
pub fn colorbar(&self) -> Option<ColorBarWidget>
A ColorBarWidget for the scatter’s value colormap, used by
Self::show to render the side colorbar (silx
ScatterView.getColorBarWidget, ScatterView.py:83-88). The bar’s value
limits track the colormap’s vmin/vmax. Returns None before any data
has been uploaded.
Sourcepub fn scatter_mask(&self) -> &ScatterMaskWidget
pub fn scatter_mask(&self) -> &ScatterMaskWidget
The scatter mask, sized to the point count of the last Self::set_data
(silx ScatterView.getMaskToolsDockWidget().getSelectionMask(),
ScatterView.py:116-122). Drive selections via its geometric / threshold
operations (e.g. ScatterMaskWidget::update_rectangle); the resulting
non-zero levels flag the masked points, queryable via
Self::masked_selection.
Sourcepub fn scatter_mask_mut(&mut self) -> &mut ScatterMaskWidget
pub fn scatter_mask_mut(&mut self) -> &mut ScatterMaskWidget
Mutable access to the scatter mask, to apply selection operations against
the scatter’s point arrays (silx ScatterMaskToolsWidget).
Sourcepub fn masked_selection(&self) -> Vec<bool>
pub fn masked_selection(&self) -> Vec<bool>
The boolean point selection applied to the scatter: one entry per point,
true where the mask level is non-zero (silx scatter mask selection).
Sourcepub fn selection_mask(&self) -> &[u8] ⓘ
pub fn selection_mask(&self) -> &[u8] ⓘ
The per-point selection mask as raw levels (silx
ScatterView.getSelectionMask): one u8 per scatter point, 0
unmasked and 1..=255 a mask level. Empty until Self::set_data has
sized it to the point count — silx returns an empty array when there is
no active scatter.
Sourcepub fn set_selection_mask(
&mut self,
mask: &[u8],
) -> Result<usize, PlotDataError>
pub fn set_selection_mask( &mut self, mask: &[u8], ) -> Result<usize, PlotDataError>
Replace the per-point selection mask (silx
ScatterView.setSelectionMask).
mask must have exactly one entry per scatter point — the current
selection_mask length (the last
Self::set_data point count). On success the new mask is committed to
the undo history and its point count returned; a length mismatch returns
PlotDataError and leaves the mask unchanged (silx raises ValueError
on a shape mismatch).
Sourcepub fn cursor(&self) -> Option<[f64; 2]>
pub fn cursor(&self) -> Option<[f64; 2]>
The last cursor data coordinates (x, y) fed into the position-info
readout (silx ScatterView sigMouseMoved), or None before the
pointer has moved over the data area.
Sourcepub fn show_position_info(&mut self, ui: &mut Ui, response: &PlotResponse)
pub fn show_position_info(&mut self, ui: &mut Ui, response: &PlotResponse)
Show the silx ScatterView position-info bar below the plot: the X,
Y, Data, Index columns, snapping to the scatter point under the
cursor (silx ScatterView.py:90-101 + _pickScatterData).
Pass the PlotResponse returned by Self::show this frame: the
cursor is updated from its pointer event and the pick is done in pixel
space through its display Transform (so the snap radius is constant on
screen regardless of zoom). When a point is within
SCATTER_PICK_RADIUS_PX of the cursor, X/Y snap to it and
Data/Index show its value/index; otherwise X/Y show the cursor
coordinates and Data/Index show "-".
Sourcepub fn mask_rectangle(
&mut self,
anchor: (f64, f64),
size: (f64, f64),
mask: bool,
)
pub fn mask_rectangle( &mut self, anchor: (f64, f64), size: (f64, f64), mask: bool, )
Mask (or unmask) the scatter points inside the data-space rectangle with
bottom-left anchor = (x, y) and size = (width, height), at the
current mask level, then commit it to the undo history (silx
ScatterMask.updateRectangle over the scatter points). Uses the
retained point coordinates from the last Self::set_data.
Sourcepub fn mask_polygon(&mut self, vertices: &[(f64, f64)], mask: bool)
pub fn mask_polygon(&mut self, vertices: &[(f64, f64)], mask: bool)
Mask (or unmask) the scatter points inside the data-space polygon
vertices ((x, y) corners), at the current mask level, then commit it
to the undo history (silx ScatterMask.updatePolygon). Uses the retained
point coordinates from the last Self::set_data.
Sourcepub fn show_mask_tools(&mut self, ui: &mut Ui) -> bool
pub fn show_mask_tools(&mut self, ui: &mut Ui) -> bool
Render the scatter mask-tools panel beside the plot (silx
ScatterView mask dock, ScatterView.py:116-122).
Exposes the whole-mask operations (clear-level / clear-all / invert /
undo / redo) plus value-threshold selection over the scatter’s value
array; geometric selections (rectangle / polygon / disk) are driven
programmatically through Self::scatter_mask_mut. The resulting
boolean selection (Self::masked_selection) is applied to the scatter
— masked points are flagged. Returns true when the selection changed
this frame.
Sourcepub fn show_toolbar(&mut self, ui: &mut Ui) -> ToolbarResponse
pub fn show_toolbar(&mut self, ui: &mut Ui) -> ToolbarResponse
Show the standard toolbar plus a colorbar show/hide toggle.
The colorbar toggle mirrors silx ColorBarAction; clicking it flips
whether Self::show reserves the side colorbar column.
Sourcepub fn show(&mut self, ui: &mut Ui) -> PlotResponse
pub fn show(&mut self, ui: &mut Ui) -> PlotResponse
Render the scatter plot with the value colorbar beside it.
The colorbar occupies a fixed-width column on the right, synced to the
value colormap’s limits (silx ScatterView grid colorbar,
ScatterView.py:83-88). Before any data is uploaded no colorbar is drawn.
Methods from Deref<Target = PlotWidget>§
Sourcepub fn show(&mut self, ui: &mut Ui) -> PlotResponse
pub fn show(&mut self, ui: &mut Ui) -> PlotResponse
Render the widget in ui, handling interaction and plot item selection.
Render the widget like Self::show, appending custom entries to the
plot’s built-in right-click context menu (after the Zoom Back / Reset
Zoom items), mirroring silx plotContextMenu.py adding actions to the
plot’s default menu.
This is the ONLY way to add custom menu entries: calling
Response::context_menu on the returned response would register a
second menu on a response that already carries the built-in one, and
egui then closes the menu in the same frame it opens — no menu appears
at all. The closure only renders entries and signals choices (e.g. via
captured flags applied after show returns); it cannot borrow the
widget itself while the plot is being shown.
Sourcepub fn backend(&self) -> &WgpuBackend
pub fn backend(&self) -> &WgpuBackend
Access the underlying backend.
Sourcepub fn backend_mut(&mut self) -> &mut WgpuBackend
pub fn backend_mut(&mut self) -> &mut WgpuBackend
Mutably access the underlying backend.
Sourcepub fn set_auto_reset_zoom(&mut self, on: bool)
pub fn set_auto_reset_zoom(&mut self, on: bool)
Toggle whether newly added data updates the displayed data limits.
Sourcepub fn auto_reset_zoom(&self) -> bool
pub fn auto_reset_zoom(&self) -> bool
Whether newly added data updates the displayed data limits.
Sourcepub fn set_interaction_mode(&mut self, mode: PlotInteractionMode)
pub fn set_interaction_mode(&mut self, mode: PlotInteractionMode)
Set the primary pointer interaction mode used by Self::show.
Sourcepub fn interaction_mode(&self) -> PlotInteractionMode
pub fn interaction_mode(&self) -> PlotInteractionMode
Primary pointer interaction mode used by Self::show.
Sourcepub fn set_roi_create_mode(&mut self, kind: RoiDrawKind)
pub fn set_roi_create_mode(&mut self, kind: RoiDrawKind)
Arm on-plot creation of a new ROI of kind (silx
RegionOfInterestManager.start(roiClass)). A convenience for
set_interaction_mode(PlotInteractionMode::RoiCreate(kind)): the next
primary drag (or click, for RoiDrawKind::Point/RoiDrawKind::Cross)
draws the shape; finishing it appends the ROI to plot().rois and queues
a PlotEvent::RoiCreated. Creation re-arms continuously until the mode
is changed.
Sourcepub fn roi_creation_message(&self) -> Option<String>
pub fn roi_creation_message(&self) -> Option<String>
The ROI-creation status message for the current interaction mode and ROI
count, for display in a host status bar (silx
InteractiveRegionOfInterestManager.getMessage). Some("Select {name}s ({n} selected)") while an on-plot ROI creation mode is armed (the kind
being drawn + the current ROI count), else None. Delegates to
PlotInteractionMode::roi_creation_message.
Sourcepub fn drain_events(&mut self) -> Vec<PlotEvent>
pub fn drain_events(&mut self) -> Vec<PlotEvent>
Take queued plot events.
Sourcepub fn add_curve(&mut self, x: &[f64], y: &[f64], color: Color32) -> ItemHandle
pub fn add_curve(&mut self, x: &[f64], y: &[f64], color: Color32) -> ItemHandle
Add a curve with default silx-like styling.
Sourcepub fn add_curve_with_legend(
&mut self,
x: &[f64],
y: &[f64],
color: Color32,
legend: impl Into<String>,
) -> ItemHandle
pub fn add_curve_with_legend( &mut self, x: &[f64], y: &[f64], color: Color32, legend: impl Into<String>, ) -> ItemHandle
Add a curve and assign a legend label.
Sourcepub fn add_curve_data(&mut self, curve: &CurveData) -> ItemHandle
pub fn add_curve_data(&mut self, curve: &CurveData) -> ItemHandle
Add a curve from an existing CurveData value.
Sourcepub fn add_curve_data_with_legend(
&mut self,
curve: &CurveData,
legend: impl Into<String>,
) -> ItemHandle
pub fn add_curve_data_with_legend( &mut self, curve: &CurveData, legend: impl Into<String>, ) -> ItemHandle
Add a curve from CurveData and assign a legend label in one call.
Sourcepub fn add_curve_spec(&mut self, spec: CurveSpec<'_>) -> ItemHandle
pub fn add_curve_spec(&mut self, spec: CurveSpec<'_>) -> ItemHandle
Add a curve from the full backend spec.
Sourcepub fn update_curve_spec(
&mut self,
handle: ItemHandle,
spec: CurveSpec<'_>,
) -> bool
pub fn update_curve_spec( &mut self, handle: ItemHandle, spec: CurveSpec<'_>, ) -> bool
Replace an existing curve by handle.
Sourcepub fn update_curve_data(
&mut self,
handle: ItemHandle,
curve: &CurveData,
) -> bool
pub fn update_curve_data( &mut self, handle: ItemHandle, curve: &CurveData, ) -> bool
Replace an existing curve by handle from CurveData.
Sourcepub fn add_scatter(
&mut self,
x: &[f64],
y: &[f64],
color: Color32,
) -> ItemHandle
pub fn add_scatter( &mut self, x: &[f64], y: &[f64], color: Color32, ) -> ItemHandle
Add a scatter item: markers at every (x, y) point, with no connecting line.
Sourcepub fn add_scatter_with_legend(
&mut self,
x: &[f64],
y: &[f64],
color: Color32,
legend: impl Into<String>,
) -> ItemHandle
pub fn add_scatter_with_legend( &mut self, x: &[f64], y: &[f64], color: Color32, legend: impl Into<String>, ) -> ItemHandle
Add a scatter item and assign a legend label.
Sourcepub fn add_scatter_with_symbol(
&mut self,
x: &[f64],
y: &[f64],
color: Color32,
symbol: Symbol,
symbol_size: f32,
) -> ItemHandle
pub fn add_scatter_with_symbol( &mut self, x: &[f64], y: &[f64], color: Color32, symbol: Symbol, symbol_size: f32, ) -> ItemHandle
Add a scatter item with explicit marker symbol and size.
Sourcepub fn add_histogram(
&mut self,
edges: &[f64],
counts: &[f64],
color: Color32,
) -> Result<ItemHandle, PlotDataError>
pub fn add_histogram( &mut self, edges: &[f64], counts: &[f64], color: Color32, ) -> Result<ItemHandle, PlotDataError>
Add a histogram from bin edges and bin counts.
Sourcepub fn add_histogram_with_legend(
&mut self,
edges: &[f64],
counts: &[f64],
color: Color32,
legend: impl Into<String>,
) -> Result<ItemHandle, PlotDataError>
pub fn add_histogram_with_legend( &mut self, edges: &[f64], counts: &[f64], color: Color32, legend: impl Into<String>, ) -> Result<ItemHandle, PlotDataError>
Add a histogram and assign a legend label.
Sourcepub fn add_histogram_aligned(
&mut self,
positions: &[f64],
counts: &[f64],
color: Color32,
align: HistogramAlign,
) -> Result<ItemHandle, PlotDataError>
pub fn add_histogram_aligned( &mut self, positions: &[f64], counts: &[f64], color: Color32, align: HistogramAlign, ) -> Result<ItemHandle, PlotDataError>
Add a histogram from N bin positions and N counts, deriving the
N + 1 bin edges from align (silx Histogram.setData(align=)).
The edges are computed by histogram_edges; positions.len() must equal
counts.len() (mismatched lengths surface as
PlotDataError::HistogramLength from the underlying Self::add_histogram).
Sourcepub fn add_histogram_aligned_with_legend(
&mut self,
positions: &[f64],
counts: &[f64],
color: Color32,
align: HistogramAlign,
legend: impl Into<String>,
) -> Result<ItemHandle, PlotDataError>
pub fn add_histogram_aligned_with_legend( &mut self, positions: &[f64], counts: &[f64], color: Color32, align: HistogramAlign, legend: impl Into<String>, ) -> Result<ItemHandle, PlotDataError>
Add an aligned histogram (see Self::add_histogram_aligned) and assign a
legend label.
Sourcepub fn add_image(
&mut self,
width: u32,
height: u32,
data: &[f32],
colormap: Colormap,
) -> ItemHandle
pub fn add_image( &mut self, width: u32, height: u32, data: &[f32], colormap: Colormap, ) -> ItemHandle
Add a scalar image with unit scale and origin (0, 0).
Sourcepub fn try_add_image(
&mut self,
width: u32,
height: u32,
data: &[f32],
colormap: Colormap,
) -> Result<ItemHandle, PlotDataError>
pub fn try_add_image( &mut self, width: u32, height: u32, data: &[f32], colormap: Colormap, ) -> Result<ItemHandle, PlotDataError>
Add a scalar image, returning an error instead of panicking on length mismatch.
Sourcepub fn add_image_default(
&mut self,
width: u32,
height: u32,
data: &[f32],
) -> ItemHandle
pub fn add_image_default( &mut self, width: u32, height: u32, data: &[f32], ) -> ItemHandle
Add a scalar image using the widget’s default colormap.
Sourcepub fn try_add_image_default(
&mut self,
width: u32,
height: u32,
data: &[f32],
) -> Result<ItemHandle, PlotDataError>
pub fn try_add_image_default( &mut self, width: u32, height: u32, data: &[f32], ) -> Result<ItemHandle, PlotDataError>
Add a scalar image using the widget’s default colormap, returning an error instead of panicking on length mismatch.
Sourcepub fn add_image_with_geometry(
&mut self,
width: u32,
height: u32,
data: &[f32],
colormap: Colormap,
geometry: ImageGeometry,
) -> Result<ItemHandle, PlotDataError>
pub fn add_image_with_geometry( &mut self, width: u32, height: u32, data: &[f32], colormap: Colormap, geometry: ImageGeometry, ) -> Result<ItemHandle, PlotDataError>
Add a scalar image with explicit origin/scale/alpha.
Sourcepub fn add_image_with_legend(
&mut self,
width: u32,
height: u32,
data: &[f32],
legend: impl Into<String>,
) -> ItemHandle
pub fn add_image_with_legend( &mut self, width: u32, height: u32, data: &[f32], legend: impl Into<String>, ) -> ItemHandle
Add a scalar image using the widget’s default colormap and assign a legend label.
Sourcepub fn add_rgba_image(
&mut self,
width: u32,
height: u32,
data: &[[u8; 4]],
) -> ItemHandle
pub fn add_rgba_image( &mut self, width: u32, height: u32, data: &[[u8; 4]], ) -> ItemHandle
Add a direct RGBA image with unit scale and origin (0, 0).
Sourcepub fn add_rgba_image_with_legend(
&mut self,
width: u32,
height: u32,
data: &[[u8; 4]],
legend: impl Into<String>,
) -> ItemHandle
pub fn add_rgba_image_with_legend( &mut self, width: u32, height: u32, data: &[[u8; 4]], legend: impl Into<String>, ) -> ItemHandle
Add a direct RGBA image and assign a legend label.
Sourcepub fn try_add_rgba_image(
&mut self,
width: u32,
height: u32,
data: &[[u8; 4]],
) -> Result<ItemHandle, PlotDataError>
pub fn try_add_rgba_image( &mut self, width: u32, height: u32, data: &[[u8; 4]], ) -> Result<ItemHandle, PlotDataError>
Add a direct RGBA image, returning an error instead of panicking on length mismatch.
Sourcepub fn add_rgba_image_with_geometry(
&mut self,
width: u32,
height: u32,
data: &[[u8; 4]],
geometry: ImageGeometry,
) -> Result<ItemHandle, PlotDataError>
pub fn add_rgba_image_with_geometry( &mut self, width: u32, height: u32, data: &[[u8; 4]], geometry: ImageGeometry, ) -> Result<ItemHandle, PlotDataError>
Add a direct RGBA image with explicit origin/scale/alpha.
Sourcepub fn add_image_data(&mut self, image: &ImageData) -> ItemHandle
pub fn add_image_data(&mut self, image: &ImageData) -> ItemHandle
Add an image from an existing ImageData value.
Sourcepub fn add_image_spec(&mut self, spec: ImageSpec<'_>) -> ItemHandle
pub fn add_image_spec(&mut self, spec: ImageSpec<'_>) -> ItemHandle
Add an image from the full backend spec.
Sourcepub fn update_image_spec(
&mut self,
handle: ItemHandle,
spec: ImageSpec<'_>,
) -> bool
pub fn update_image_spec( &mut self, handle: ItemHandle, spec: ImageSpec<'_>, ) -> bool
Replace an existing image by handle.
Sourcepub fn try_update_image(
&mut self,
handle: ItemHandle,
width: u32,
height: u32,
data: &[f32],
colormap: Colormap,
) -> Result<bool, PlotDataError>
pub fn try_update_image( &mut self, handle: ItemHandle, width: u32, height: u32, data: &[f32], colormap: Colormap, ) -> Result<bool, PlotDataError>
Replace an existing scalar image, returning an error instead of panicking on length mismatch.
Sourcepub fn try_update_rgba_image(
&mut self,
handle: ItemHandle,
width: u32,
height: u32,
data: &[[u8; 4]],
) -> Result<bool, PlotDataError>
pub fn try_update_rgba_image( &mut self, handle: ItemHandle, width: u32, height: u32, data: &[[u8; 4]], ) -> Result<bool, PlotDataError>
Replace an existing direct RGBA image, returning an error instead of panicking on length mismatch.
Sourcepub fn update_image_data(
&mut self,
handle: ItemHandle,
image: &ImageData,
) -> bool
pub fn update_image_data( &mut self, handle: ItemHandle, image: &ImageData, ) -> bool
Replace an existing image by handle from ImageData.
Sourcepub fn add_mask(
&mut self,
width: u32,
height: u32,
mask: &[bool],
color: Color32,
) -> Result<ItemHandle, PlotDataError>
pub fn add_mask( &mut self, width: u32, height: u32, mask: &[bool], color: Color32, ) -> Result<ItemHandle, PlotDataError>
Add a boolean mask as a transparent RGBA overlay.
Sourcepub fn add_mask_with_geometry(
&mut self,
width: u32,
height: u32,
mask: &[bool],
color: Color32,
geometry: ImageGeometry,
) -> Result<ItemHandle, PlotDataError>
pub fn add_mask_with_geometry( &mut self, width: u32, height: u32, mask: &[bool], color: Color32, geometry: ImageGeometry, ) -> Result<ItemHandle, PlotDataError>
Add a boolean mask as a transparent RGBA overlay with explicit geometry.
Sourcepub fn add_rgba_mask(
&mut self,
width: u32,
height: u32,
pixels: &[[u8; 4]],
) -> Result<ItemHandle, PlotDataError>
pub fn add_rgba_mask( &mut self, width: u32, height: u32, pixels: &[[u8; 4]], ) -> Result<ItemHandle, PlotDataError>
Add raw per-pixel RGBA pixels as a mask-kind overlay item.
Unlike add_mask (a boolean stencil painted in one
color), this carries fully resolved per-pixel RGBA, so a multi-level
mask can map each level through its own LUT entry (silx
_BaseMaskToolsWidget discrete mask colormap). pixels is row-major,
width * height long.
Sourcepub fn add_mask_with_legend(
&mut self,
width: u32,
height: u32,
mask: &[bool],
color: Color32,
legend: impl Into<String>,
) -> Result<ItemHandle, PlotDataError>
pub fn add_mask_with_legend( &mut self, width: u32, height: u32, mask: &[bool], color: Color32, legend: impl Into<String>, ) -> Result<ItemHandle, PlotDataError>
Add a boolean mask overlay and assign a legend label.
Sourcepub fn add_horizontal_profile_curve(
&mut self,
width: u32,
height: u32,
data: &[f32],
row: u32,
color: Color32,
) -> Result<ItemHandle, PlotDataError>
pub fn add_horizontal_profile_curve( &mut self, width: u32, height: u32, data: &[f32], row: u32, color: Color32, ) -> Result<ItemHandle, PlotDataError>
Add a horizontal image profile as a curve.
Sourcepub fn add_vertical_profile_curve(
&mut self,
width: u32,
height: u32,
data: &[f32],
column: u32,
color: Color32,
) -> Result<ItemHandle, PlotDataError>
pub fn add_vertical_profile_curve( &mut self, width: u32, height: u32, data: &[f32], column: u32, color: Color32, ) -> Result<ItemHandle, PlotDataError>
Add a vertical image profile as a curve.
Sourcepub fn add_triangles(&mut self, spec: TriangleSpec<'_>) -> ItemHandle
pub fn add_triangles(&mut self, spec: TriangleSpec<'_>) -> ItemHandle
Add a triangle mesh.
Sourcepub fn add_triangles_data(&mut self, triangles: &Triangles) -> ItemHandle
pub fn add_triangles_data(&mut self, triangles: &Triangles) -> ItemHandle
Add a triangle mesh from an existing Triangles value.
Sourcepub fn add_triangles_data_with_legend(
&mut self,
triangles: &Triangles,
legend: impl Into<String>,
) -> ItemHandle
pub fn add_triangles_data_with_legend( &mut self, triangles: &Triangles, legend: impl Into<String>, ) -> ItemHandle
Add a triangle mesh from Triangles and assign a legend label.
Sourcepub fn add_shape(&mut self, spec: ShapeSpec<'_>) -> ItemHandle
pub fn add_shape(&mut self, spec: ShapeSpec<'_>) -> ItemHandle
Add a shape overlay.
Sourcepub fn add_shape_data(&mut self, shape: &Shape) -> ItemHandle
pub fn add_shape_data(&mut self, shape: &Shape) -> ItemHandle
Add a shape overlay from an existing Shape value.
Sourcepub fn add_shape_data_with_legend(
&mut self,
shape: &Shape,
legend: impl Into<String>,
) -> ItemHandle
pub fn add_shape_data_with_legend( &mut self, shape: &Shape, legend: impl Into<String>, ) -> ItemHandle
Add a shape overlay from Shape and assign a legend label.
Sourcepub fn add_rectangle(
&mut self,
x0: f64,
y0: f64,
x1: f64,
y1: f64,
color: Color32,
fill: bool,
) -> ItemHandle
pub fn add_rectangle( &mut self, x0: f64, y0: f64, x1: f64, y1: f64, color: Color32, fill: bool, ) -> ItemHandle
Add a rectangle shape.
Sourcepub fn add_marker(&mut self, spec: MarkerSpec<'_>) -> ItemHandle
pub fn add_marker(&mut self, spec: MarkerSpec<'_>) -> ItemHandle
Add a point or line marker.
Sourcepub fn add_marker_data(&mut self, marker: &Marker) -> ItemHandle
pub fn add_marker_data(&mut self, marker: &Marker) -> ItemHandle
Add a marker from an existing Marker value.
Sourcepub fn add_marker_data_with_legend(
&mut self,
marker: &Marker,
legend: impl Into<String>,
) -> ItemHandle
pub fn add_marker_data_with_legend( &mut self, marker: &Marker, legend: impl Into<String>, ) -> ItemHandle
Add a marker from Marker and assign a legend label.
Sourcepub fn add_point_marker(
&mut self,
x: f64,
y: f64,
color: Color32,
symbol: MarkerSymbol,
) -> ItemHandle
pub fn add_point_marker( &mut self, x: f64, y: f64, color: Color32, symbol: MarkerSymbol, ) -> ItemHandle
Add a point marker.
Sourcepub fn add_x_marker(&mut self, x: f64, color: Color32) -> ItemHandle
pub fn add_x_marker(&mut self, x: f64, color: Color32) -> ItemHandle
Add a vertical marker line.
Sourcepub fn add_y_marker(
&mut self,
y: f64,
color: Color32,
axis: YAxis,
) -> ItemHandle
pub fn add_y_marker( &mut self, y: f64, color: Color32, axis: YAxis, ) -> ItemHandle
Add a horizontal marker line.
Sourcepub fn marker_position(&self, handle: ItemHandle) -> Option<(f64, f64)>
pub fn marker_position(&self, handle: ItemHandle) -> Option<(f64, f64)>
The current data position (x, y) of the marker handle (silx
MarkerBase.getPosition), or None if no marker with that handle
exists. For a line marker the off-axis coordinate is reported as 0.0
(see Marker::position).
Sourcepub fn set_marker_position(
&mut self,
handle: ItemHandle,
x: f64,
y: f64,
) -> bool
pub fn set_marker_position( &mut self, handle: ItemHandle, x: f64, y: f64, ) -> bool
Move the marker handle to data position (x, y), applying the marker’s
drag constraint (silx MarkerBase.setPosition), and emit
PlotEvent::MarkerMoved. Returns false if no marker with that handle
exists (no event is emitted in that case).
The constraint is applied via Marker::drag anchored at the marker’s
current position, so a 'horizontal' / 'vertical' preset pins the
constrained coordinate exactly as an on-screen drag would. A
non-draggable marker does not move (Marker::drag is a no-op when
is_draggable is false), matching silx, but the call still returns
true and emits the event because the marker exists.
Sourcepub fn remove(&mut self, handle: ItemHandle) -> bool
pub fn remove(&mut self, handle: ItemHandle) -> bool
Remove an item by handle.
Sourcepub fn clear_curves(&mut self)
pub fn clear_curves(&mut self)
Remove all curve-like items.
Sourcepub fn clear_images(&mut self)
pub fn clear_images(&mut self)
Remove all image-like items.
Sourcepub fn clear_items(&mut self)
pub fn clear_items(&mut self)
Remove all shape and triangle overlay items.
Sourcepub fn clear_markers(&mut self)
pub fn clear_markers(&mut self)
Remove all marker items.
Sourcepub fn clear_histograms(&mut self)
pub fn clear_histograms(&mut self)
Remove all histogram items.
Sourcepub fn clear_scatters(&mut self)
pub fn clear_scatters(&mut self)
Remove all scatter items.
Sourcepub fn clear_masks(&mut self)
pub fn clear_masks(&mut self)
Remove all mask overlay items.
Sourcepub fn remove_curve(&mut self, handle: ItemHandle) -> bool
pub fn remove_curve(&mut self, handle: ItemHandle) -> bool
Remove a curve-like item by handle.
Sourcepub fn remove_image(&mut self, handle: ItemHandle) -> bool
pub fn remove_image(&mut self, handle: ItemHandle) -> bool
Remove an image-like item by handle.
Sourcepub fn remove_histogram(&mut self, handle: ItemHandle) -> bool
pub fn remove_histogram(&mut self, handle: ItemHandle) -> bool
Remove a histogram item by handle.
Sourcepub fn remove_scatter(&mut self, handle: ItemHandle) -> bool
pub fn remove_scatter(&mut self, handle: ItemHandle) -> bool
Remove a scatter item by handle.
Sourcepub fn remove_mask(&mut self, handle: ItemHandle) -> bool
pub fn remove_mask(&mut self, handle: ItemHandle) -> bool
Remove a mask item by handle.
Sourcepub fn remove_marker(&mut self, handle: ItemHandle) -> bool
pub fn remove_marker(&mut self, handle: ItemHandle) -> bool
Remove a marker item by handle.
Sourcepub fn remove_overlay_item(&mut self, handle: ItemHandle) -> bool
pub fn remove_overlay_item(&mut self, handle: ItemHandle) -> bool
Remove a shape or triangle overlay item by handle.
Sourcepub fn get_items(&self) -> Vec<ItemHandle> ⓘ
pub fn get_items(&self) -> Vec<ItemHandle> ⓘ
Return every backend item handle in draw order.
Sourcepub fn get_all_curves(&self) -> Vec<ItemHandle> ⓘ
pub fn get_all_curves(&self) -> Vec<ItemHandle> ⓘ
Return curve-like handles in draw order.
Sourcepub fn get_all_images(&self) -> Vec<ItemHandle> ⓘ
pub fn get_all_images(&self) -> Vec<ItemHandle> ⓘ
Return image-like handles in draw order.
Sourcepub fn get_all_markers(&self) -> Vec<ItemHandle> ⓘ
pub fn get_all_markers(&self) -> Vec<ItemHandle> ⓘ
Return marker handles in draw order.
Sourcepub fn get_all_histograms(&self) -> Vec<ItemHandle> ⓘ
pub fn get_all_histograms(&self) -> Vec<ItemHandle> ⓘ
Return histogram handles in draw order.
Sourcepub fn get_all_scatters(&self) -> Vec<ItemHandle> ⓘ
pub fn get_all_scatters(&self) -> Vec<ItemHandle> ⓘ
Return scatter handles in draw order.
Sourcepub fn get_all_masks(&self) -> Vec<ItemHandle> ⓘ
pub fn get_all_masks(&self) -> Vec<ItemHandle> ⓘ
Return mask handles in draw order.
Sourcepub fn item_by_legend(&self, legend: &str) -> Option<ItemHandle>
pub fn item_by_legend(&self, legend: &str) -> Option<ItemHandle>
Return the first item handle with this legend label.
Sourcepub fn curve_by_legend(&self, legend: &str) -> Option<ItemHandle>
pub fn curve_by_legend(&self, legend: &str) -> Option<ItemHandle>
Return the first curve-like item handle with this legend label.
Sourcepub fn image_by_legend(&self, legend: &str) -> Option<ItemHandle>
pub fn image_by_legend(&self, legend: &str) -> Option<ItemHandle>
Return the first image-like item handle with this legend label.
Sourcepub fn histogram_by_legend(&self, legend: &str) -> Option<ItemHandle>
pub fn histogram_by_legend(&self, legend: &str) -> Option<ItemHandle>
Return the first histogram item handle with this legend label.
Sourcepub fn scatter_by_legend(&self, legend: &str) -> Option<ItemHandle>
pub fn scatter_by_legend(&self, legend: &str) -> Option<ItemHandle>
Return the first scatter item handle with this legend label.
Sourcepub fn mask_by_legend(&self, legend: &str) -> Option<ItemHandle>
pub fn mask_by_legend(&self, legend: &str) -> Option<ItemHandle>
Return the first mask item handle with this legend label.
Sourcepub fn item_kind(&self, handle: ItemHandle) -> Option<PlotItemKind>
pub fn item_kind(&self, handle: ItemHandle) -> Option<PlotItemKind>
Return the high-level family of an item.
Sourcepub fn set_item_legend(
&mut self,
handle: ItemHandle,
legend: impl Into<String>,
) -> bool
pub fn set_item_legend( &mut self, handle: ItemHandle, legend: impl Into<String>, ) -> bool
Attach or replace the legend label for an item.
Sourcepub fn clear_item_legend(&mut self, handle: ItemHandle) -> bool
pub fn clear_item_legend(&mut self, handle: ItemHandle) -> bool
Remove the legend label from an item.
Sourcepub fn item_legend(&self, handle: ItemHandle) -> Option<&str>
pub fn item_legend(&self, handle: ItemHandle) -> Option<&str>
Legend label assigned to an item.
Sourcepub fn set_curve_x_label(
&mut self,
handle: ItemHandle,
label: impl Into<String>,
) -> bool
pub fn set_curve_x_label( &mut self, handle: ItemHandle, label: impl Into<String>, ) -> bool
Set the curve’s X-axis label, shown on the X axis while it is the active
curve (silx Curve.setXLabel). The active curve’s label overrides the
graph default (Self::set_graph_x_label). Returns false for an
unknown handle.
Sourcepub fn clear_curve_x_label(&mut self, handle: ItemHandle) -> bool
pub fn clear_curve_x_label(&mut self, handle: ItemHandle) -> bool
Remove the curve’s X-axis label, so the graph default shows when it is
active (silx setting the label back to None).
Sourcepub fn curve_x_label(&self, handle: ItemHandle) -> Option<&str>
pub fn curve_x_label(&self, handle: ItemHandle) -> Option<&str>
The curve’s X-axis label, if set (silx Curve.getXLabel).
Sourcepub fn set_curve_y_label(
&mut self,
handle: ItemHandle,
label: impl Into<String>,
) -> bool
pub fn set_curve_y_label( &mut self, handle: ItemHandle, label: impl Into<String>, ) -> bool
Set the curve’s Y-axis label, shown on the left or right (y2) axis (per
the curve’s Y-axis binding) while it is the active curve (silx
Curve.setYLabel). Returns false for an unknown handle.
Sourcepub fn clear_curve_y_label(&mut self, handle: ItemHandle) -> bool
pub fn clear_curve_y_label(&mut self, handle: ItemHandle) -> bool
Remove the curve’s Y-axis label, so the graph default shows when it is active.
Sourcepub fn curve_y_label(&self, handle: ItemHandle) -> Option<&str>
pub fn curve_y_label(&self, handle: ItemHandle) -> Option<&str>
The curve’s Y-axis label, if set (silx Curve.getYLabel).
Sourcepub fn active_item(&self) -> Option<ItemHandle>
pub fn active_item(&self) -> Option<ItemHandle>
Currently active item.
Sourcepub fn set_active_item(&mut self, item: Option<ItemHandle>) -> bool
pub fn set_active_item(&mut self, item: Option<ItemHandle>) -> bool
Set the active item, emitting PlotEvent::ActiveItemChanged when it changes.
Sourcepub fn active_curve(&self) -> Option<ItemHandle>
pub fn active_curve(&self) -> Option<ItemHandle>
Currently active curve-like item.
Sourcepub fn active_curve_style(&self) -> &CurveStyle
pub fn active_curve_style(&self) -> &CurveStyle
The override style applied to the active curve when active-curve
handling is enabled (silx PlotWidget.getActiveCurveStyle).
Sourcepub fn is_active_curve_handling(&self) -> bool
pub fn is_active_curve_handling(&self) -> bool
Whether the active curve is highlighted with the active-curve style
(silx PlotWidget.isActiveCurveHandling).
Sourcepub fn set_active_curve_style(&mut self, style: CurveStyle)
pub fn set_active_curve_style(&mut self, style: CurveStyle)
Set the override style applied to the active curve (silx
PlotWidget.setActiveCurveStyle), then re-apply it to the active curve
through the single highlight owner so the change takes effect at once.
Sourcepub fn set_active_curve_handling(&mut self, enabled: bool)
pub fn set_active_curve_handling(&mut self, enabled: bool)
Enable or disable active-curve highlighting (silx
PlotWidget.setActiveCurveHandling), then re-sync the active curve:
enabling applies the highlight, disabling reverts it to its base style.
Sourcepub fn active_curve_line_style(&self) -> Option<LineStyle>
pub fn active_curve_line_style(&self) -> Option<LineStyle>
The current line style of the active curve-like item, if one is active and its style is retained.
Sourcepub fn is_default_plot_lines(&self) -> bool
pub fn is_default_plot_lines(&self) -> bool
Whether curves default to being drawn with a connecting line (silx
PlotWidget.isDefaultPlotLines).
Sourcepub fn is_default_plot_points(&self) -> bool
pub fn is_default_plot_points(&self) -> bool
Whether curves default to being drawn with point markers (silx
PlotWidget.isDefaultPlotPoints).
Sourcepub fn set_default_plot_lines(&mut self, flag: bool) -> usize
pub fn set_default_plot_lines(&mut self, flag: bool) -> usize
Set the default line style of every curve, mirroring silx
PlotWidget.setDefaultPlotLines: true applies a solid line (silx
"-"), false removes the line (silx " "). Like silx, this resets the
line style of all existing curves (silx iterates getAllCurves; siplot
iterates PlotItemKind::Curve items, the equivalent set — histograms
and scatters are excluded). Returns the number of curves whose line style
actually changed.
Sourcepub fn set_default_plot_points(&mut self, flag: bool) -> usize
pub fn set_default_plot_points(&mut self, flag: bool) -> usize
Set the default symbol of every curve, mirroring silx
PlotWidget.setDefaultPlotPoints: true applies the o (Circle) symbol
(silx.config.DEFAULT_PLOT_SYMBOL), false removes the symbol. Resets
the symbol of all existing curves (same item set as
Self::set_default_plot_lines). Returns the number of curves whose
symbol actually changed.
Sourcepub fn cycle_curve_style(&mut self) -> (bool, bool)
pub fn cycle_curve_style(&mut self) -> (bool, bool)
Cycle the plot-wide default curve style, mirroring silx
CurveStyleAction: advances the (lines, points) state line-only →
line+symbol → symbol-only → line-only (via
crate::widget::actions::control::next_curve_style_state), then applies
the new defaults to every curve through Self::set_default_plot_lines
and Self::set_default_plot_points. Returns the new (lines, points)
state.
Sourcepub fn set_curve_y_axis(&mut self, handle: ItemHandle, axis: YAxis) -> bool
pub fn set_curve_y_axis(&mut self, handle: ItemHandle, axis: YAxis) -> bool
Move a curve between the left (YAxis::Left) and right (YAxis::Right)
Y axis (silx legend Map to left / Map to right). Clones the retained
CurveData, sets y_axis, re-applies it through
Self::update_curve_data, then recomputes auto limits because the
curve’s bounds now contribute to a different Y/Y2 range. Returns false
if the handle is unknown or has no retained curve data (non-curve item).
Sourcepub fn set_curve_points_visible(
&mut self,
handle: ItemHandle,
visible: bool,
) -> bool
pub fn set_curve_points_visible( &mut self, handle: ItemHandle, visible: bool, ) -> bool
Show or hide a curve’s point markers (silx legend checkable Points).
Toggling is lossless: hiding stashes the current Symbol in a UI-only
restore cache and showing restores that exact variant (falling back to a
default only if the curve was created with no symbol). The drawn state
is decided solely by CurveData::symbol; the cache is never read by
any render/bounds/legend path. Returns false if the handle is unknown
or has no retained curve data (non-curve item).
Sourcepub fn set_curve_lines_visible(
&mut self,
handle: ItemHandle,
visible: bool,
) -> bool
pub fn set_curve_lines_visible( &mut self, handle: ItemHandle, visible: bool, ) -> bool
Show or hide a curve’s connecting line (silx legend checkable Lines).
Toggling is lossless: hiding stashes the current LineStyle in a
UI-only restore cache and showing restores that exact style (e.g.
Dashed), falling back to a solid line only if the curve was created
with no line. The drawn state is decided solely by
CurveData::line_style; the cache is never read by any
render/bounds/legend path. Returns false if the handle is unknown or
has no retained curve data (non-curve item).
Sourcepub fn set_all_symbols(&mut self, symbol: Option<Symbol>) -> usize
pub fn set_all_symbols(&mut self, symbol: Option<Symbol>) -> usize
Set the marker symbol of every curve-like item (curve, histogram,
scatter) in one call, mirroring silx SymbolToolButton /
_SymbolToolButtonBase._markerChanged, which calls setSymbol on every
SymbolMixIn item in the plot. Some(symbol) draws that marker at each
point; None hides the markers (silx’s “None” entry, an empty symbol
string). Returns the number of items whose symbol actually changed.
Sourcepub fn set_all_symbol_sizes(&mut self, size: f32) -> usize
pub fn set_all_symbol_sizes(&mut self, size: f32) -> usize
Set the marker size (logical points) of every curve-like item, mirroring
silx SymbolToolButton / _SymbolToolButtonBase._sizeChanged, which
calls setSymbolSize on every single-symbol-size SymbolMixIn item.
siplot curves carry one size per item (no per-point sizes), so every
curve-like item qualifies. Returns the number of items whose size
actually changed.
Sourcepub fn set_active_curve(&mut self, item: Option<ItemHandle>) -> bool
pub fn set_active_curve(&mut self, item: Option<ItemHandle>) -> bool
Set the active curve-like item.
Sourcepub fn active_image(&self) -> Option<ItemHandle>
pub fn active_image(&self) -> Option<ItemHandle>
Currently active image-like item.
Sourcepub fn set_active_image(&mut self, item: Option<ItemHandle>) -> bool
pub fn set_active_image(&mut self, item: Option<ItemHandle>) -> bool
Set the active image-like item.
Sourcepub fn set_item_visible(&mut self, handle: ItemHandle, visible: bool) -> bool
pub fn set_item_visible(&mut self, handle: ItemHandle, visible: bool) -> bool
Show or hide an item. Hidden items are excluded from all draw passes.
Returns false if the handle is unknown.
Sourcepub fn is_item_visible(&self, handle: ItemHandle) -> bool
pub fn is_item_visible(&self, handle: ItemHandle) -> bool
Whether an item is currently visible.
Sourcepub fn set_item_z(&mut self, handle: ItemHandle, z: f32) -> bool
pub fn set_item_z(&mut self, handle: ItemHandle, z: f32) -> bool
Set the draw-order z-value for an item. Within each GPU item layer
(images, curves), higher-z items are drawn on top.
Returns false if the handle is unknown.
Sourcepub fn item_z_value(&self, handle: ItemHandle) -> f32
pub fn item_z_value(&self, handle: ItemHandle) -> f32
Current z-value for an item.
Sourcepub fn item_stats(&self, handle: ItemHandle) -> Option<&ItemStats>
pub fn item_stats(&self, handle: ItemHandle) -> Option<&ItemStats>
Return retained statistics for an item.
Sourcepub fn curve_stats(&self, handle: ItemHandle) -> Option<&CurveStats>
pub fn curve_stats(&self, handle: ItemHandle) -> Option<&CurveStats>
Return retained statistics for a curve-like item.
Sourcepub fn image_stats(&self, handle: ItemHandle) -> Option<&ImageStats>
pub fn image_stats(&self, handle: ItemHandle) -> Option<&ImageStats>
Return retained statistics for an image-like item.
Sourcepub fn show_legend(&mut self, ui: &mut Ui) -> LegendResponse
pub fn show_legend(&mut self, ui: &mut Ui) -> LegendResponse
Draw a selectable legend list. Clicking a row body makes it active; clicking the eye icon toggles visibility.
Sourcepub fn show_stats(&self, ui: &mut Ui, handle: ItemHandle) -> bool
pub fn show_stats(&self, ui: &mut Ui, handle: ItemHandle) -> bool
Draw retained statistics for an item. Returns false if the handle is unknown.
Sourcepub fn show_active_stats(&self, ui: &mut Ui) -> bool
pub fn show_active_stats(&self, ui: &mut Ui) -> bool
Draw retained statistics for the active item.
Sourcepub fn feed_active_stats(
&self,
stats: &mut StatsWidget,
viewport: Option<((f64, f64), (f64, f64))>,
) -> bool
pub fn feed_active_stats( &self, stats: &mut StatsWidget, viewport: Option<((f64, f64), (f64, f64))>, ) -> bool
Feed the active item’s retained data into a StatsWidget, recomputing
its rows from the live data (silx StatsWidget bound to the active
item). The row is labelled with the item’s legend.
viewport is the visible data rectangle ((x0, x1), (y0, y1)), used only
when the widget’s on-visible-data toggle is enabled. Returns true when
there is an active item with retained scalar data to feed; false
otherwise (the widget is then fed an empty input and shows no rows).
Sourcepub fn feed_all_stats(
&self,
stats: &mut StatsWidget,
viewport: Option<((f64, f64), (f64, f64))>,
) -> usize
pub fn feed_all_stats( &self, stats: &mut StatsWidget, viewport: Option<((f64, f64), (f64, f64))>, ) -> usize
Feed every plot item that has retained scalar data into a
StatsWidget, one row per item labelled by its legend — silx
StatsWidget in its default all-items mode, the counterpart to the
active-only Self::feed_active_stats (silx setDisplayOnlyActiveItem
chooses between them). Items with no retained scalar data (RGBA images,
triangles, shapes, markers) are skipped. Returns the number of rows fed.
viewport is the visible data rectangle ((x0, x1), (y0, y1)), used only
when the widget’s on-visible-data toggle is enabled.
Sourcepub fn feed_roi_stats(&self, widget: &mut RoiStatsWidget) -> bool
pub fn feed_roi_stats(&self, widget: &mut RoiStatsWidget) -> bool
Compute per-ROI statistics over the active item’s retained data and store
them in widget (silx ROIStatsWidget bound to the active item): one
row per ROI on the plot, reduced inside that ROI via image_roi_stats
(image) / curve_roi_stats (curve). Returns true when there is an
active item with retained data to reduce; false otherwise (the widget
is then cleared).
Sourcepub fn show_roi_stats_widget(&self, ui: &mut Ui, widget: &mut RoiStatsWidget)
pub fn show_roi_stats_widget(&self, ui: &mut Ui, widget: &mut RoiStatsWidget)
Feed the active item’s per-ROI statistics into widget and render its
table (silx ROIStatsWidget). Combines Self::feed_roi_stats with
RoiStatsWidget::ui; the table follows the active item and the live
ROI list.
Sourcepub fn feed_curves_roi_stats(&self, widget: &mut CurvesRoiWidget) -> bool
pub fn feed_curves_roi_stats(&self, widget: &mut CurvesRoiWidget) -> bool
Compute per-ROI raw/net counts and raw/net area over the active curve
and store them in widget (silx CurvesROIWidget): one row per curve ROI
(those with an x-span), reduced via curve_roi_counts. Returns true
when the active item is a curve with retained data; false otherwise
(the active item is an image, or there is none — the widget is cleared,
since these counts are curve-specific).
Sourcepub fn show_curves_roi_widget(&self, ui: &mut Ui, widget: &mut CurvesRoiWidget)
pub fn show_curves_roi_widget(&self, ui: &mut Ui, widget: &mut CurvesRoiWidget)
Feed the active curve’s per-ROI counts into widget and render its table
(silx CurvesROIWidget). Combines Self::feed_curves_roi_stats with
CurvesRoiWidget::ui; the table follows the active curve and the live
ROI list.
Sourcepub fn set_fit_target(&self, fit: &mut FitWidget, handle: ItemHandle) -> bool
pub fn set_fit_target(&self, fit: &mut FitWidget, handle: ItemHandle) -> bool
Feed an item’s retained curve (x, y) into a FitWidget as its fit
target, so a fit runs against the live curve (silx FitWidget.setData
bound to a plot curve). Returns true when the item is a curve with
retained data; false for an unknown handle or a non-curve item (the fit
widget is left unchanged in that case).
Sourcepub fn set_active_fit_target(&self, fit: &mut FitWidget) -> bool
pub fn set_active_fit_target(&self, fit: &mut FitWidget) -> bool
Feed the active item’s retained curve (x, y) into a FitWidget as its
fit target (silx FitWidget bound to the active curve). Returns true
when the active item is a curve with retained data.
Sourcepub fn show_active_stats_widget(
&self,
ui: &mut Ui,
stats: &mut StatsWidget,
viewport: Option<((f64, f64), (f64, f64))>,
)
pub fn show_active_stats_widget( &self, ui: &mut Ui, stats: &mut StatsWidget, viewport: Option<((f64, f64), (f64, f64))>, )
Feed the active item’s retained data into a StatsWidget and render
its table (silx StatsWidget). Combines Self::feed_active_stats with
StatsWidget::ui; the widget recomputes as the active item changes.
Sourcepub fn show_all_stats_widget(
&self,
ui: &mut Ui,
stats: &mut StatsWidget,
viewport: Option<((f64, f64), (f64, f64))>,
)
pub fn show_all_stats_widget( &self, ui: &mut Ui, stats: &mut StatsWidget, viewport: Option<((f64, f64), (f64, f64))>, )
Feed all items with retained scalar data into a StatsWidget and
render its table (silx all-items StatsWidget). Combines
Self::feed_all_stats’s selection with StatsWidget::ui; the table
follows every plot item, recomputing as items are added/removed.
Sourcepub fn show_toolbar(&mut self, ui: &mut Ui) -> ToolbarResponse
pub fn show_toolbar(&mut self, ui: &mut Ui) -> ToolbarResponse
Draw an egui-native plot toolbar.
Sourcepub fn show_limits_toolbar(&mut self, ui: &mut Ui)
pub fn show_limits_toolbar(&mut self, ui: &mut Ui)
Draw the silx LimitsToolBar (tools/LimitsToolBar.py): editable
X-min/X-max/Y-min/Y-max fields that display and control the plot’s
display limits.
The fields always reflect the current effective limits (silx’s
limitsChanged slot, which refreshes the edits on every plot limit
change). Committing an edit applies it through
set_graph_x_limits /
set_graph_y_limits, ordering the two bounds
so min ≤ max (silx _xFloatEditChanged swaps when max < min). The Y
fields edit the primary (left) axis.
Sourcepub fn show_toolbar_with<R>(
&mut self,
ui: &mut Ui,
add_contents: impl FnOnce(&mut Ui, &mut Self) -> R,
) -> (ToolbarResponse, R)
pub fn show_toolbar_with<R>( &mut self, ui: &mut Ui, add_contents: impl FnOnce(&mut Ui, &mut Self) -> R, ) -> (ToolbarResponse, R)
Draw the standard toolbar and append caller-provided controls in the same toolbar row.
The closure receives this plot after the built-in controls have been drawn, so custom actions can mutate plot state while still sharing the standard toolbar layout.
Sourcepub fn show_with_toolbar(&mut self, ui: &mut Ui) -> PlotWithToolbarResponse
pub fn show_with_toolbar(&mut self, ui: &mut Ui) -> PlotWithToolbarResponse
Draw toolbar then plot in the remaining UI.
Sourcepub fn show_with_toolbar_with<R>(
&mut self,
ui: &mut Ui,
add_toolbar_contents: impl FnOnce(&mut Ui, &mut Self) -> R,
) -> (PlotWithToolbarResponse, R)
pub fn show_with_toolbar_with<R>( &mut self, ui: &mut Ui, add_toolbar_contents: impl FnOnce(&mut Ui, &mut Self) -> R, ) -> (PlotWithToolbarResponse, R)
Draw the standard toolbar plus caller controls, then draw the plot.
Sourcepub fn show_profile_toolbar(&self, ui: &mut Ui) -> ProfileMode
pub fn show_profile_toolbar(&self, ui: &mut Ui) -> ProfileMode
Show a compact profile-mode toolbar with None / Horizontal / Vertical buttons.
The selected mode is stored in egui temp-memory keyed by the plot id so it persists across frames. Returns the current mode.
Place it inside show_toolbar_with so it sits in the same toolbar row:
let (_, mode) = plot.show_toolbar_with(ui, |ui, plot| {
ui.separator();
plot.show_profile_toolbar(ui)
});Sourcepub fn set_limits(
&mut self,
xmin: f64,
xmax: f64,
ymin: f64,
ymax: f64,
y2: Option<(f64, f64)>,
)
pub fn set_limits( &mut self, xmin: f64, xmax: f64, ymin: f64, ymax: f64, y2: Option<(f64, f64)>, )
Set graph limits.
Sourcepub fn reset_zoom(&mut self)
pub fn reset_zoom(&mut self)
Reset the displayed limits from accumulated data bounds.
Sourcepub fn zoom_back(&mut self) -> bool
pub fn zoom_back(&mut self) -> bool
Restore the most recently pushed view from the limits history (silx
LimitsHistory.pop), emitting PlotEvent::LimitsChanged if the view
changed. Returns true if a stored view was restored, or false if the
history was empty (callers fall back to Self::reset_zoom, matching
silx LimitsHistory.pop).
Sourcepub fn get_graph_x_limits(&self) -> (f64, f64)
pub fn get_graph_x_limits(&self) -> (f64, f64)
Return the current X axis limits (min, max) (alias for x_limits).
Sourcepub fn set_graph_x_limits(&mut self, xmin: f64, xmax: f64)
pub fn set_graph_x_limits(&mut self, xmin: f64, xmax: f64)
Set the X axis display limits.
Sourcepub fn y_limits(&self, axis: YAxis) -> Option<(f64, f64)>
pub fn y_limits(&self, axis: YAxis) -> Option<(f64, f64)>
Return the current Y axis limits (min, max) for axis, or None if
the axis has not been given explicit limits.
Sourcepub fn get_graph_y_limits(&self, axis: YAxis) -> Option<(f64, f64)>
pub fn get_graph_y_limits(&self, axis: YAxis) -> Option<(f64, f64)>
Return Y axis limits (alias for y_limits).
Sourcepub fn set_graph_y_limits(&mut self, ymin: f64, ymax: f64, axis: YAxis)
pub fn set_graph_y_limits(&mut self, ymin: f64, ymax: f64, axis: YAxis)
Set the Y axis display limits. Pass YAxis::Right for the secondary axis.
Sourcepub fn add_extra_y_axis(&mut self, side: AxisSide) -> usize
pub fn add_extra_y_axis(&mut self, side: AxisSide) -> usize
Add an extra (stacked) Y axis on side and return its index, usable as
YAxis::Extra(index) with set_curve_y_axis,
set_graph_y_limits, set_graph_y_label, and the extra_y_* methods
below. The axis starts linear, autoscaling, with no range or label; bind
curves to it and either set an explicit range or let reset-zoom autoscale
fit it. Same-side extra axes stack outward in creation order
(silx-style multi-axis).
Sourcepub fn extra_y_axis_count(&self) -> usize
pub fn extra_y_axis_count(&self) -> usize
The number of extra (stacked) Y axes (Plot::extra length).
Sourcepub fn set_extra_y_autoscale(&mut self, index: usize, on: bool) -> bool
pub fn set_extra_y_autoscale(&mut self, index: usize, on: bool) -> bool
Set whether extra axis index refits to its curves’ data on reset-zoom
(silx per-axis setAutoScale). Returns false for an unknown index.
Sourcepub fn set_extra_y_log(&mut self, index: usize, on: bool) -> bool
pub fn set_extra_y_log(&mut self, index: usize, on: bool) -> bool
Enable or disable a log10 scale on extra axis index (its range must be
strictly positive when on). Returns false for an unknown index.
Sourcepub fn is_extra_y_log(&self, index: usize) -> bool
pub fn is_extra_y_log(&self, index: usize) -> bool
Return true if extra axis index is logarithmic (false for an unknown
index).
Sourcepub fn set_x_log(&mut self, on: bool)
pub fn set_x_log(&mut self, on: bool)
Enable or disable a log10 X axis. Limits must be strictly positive when on.
Sourcepub fn set_graph_x_log(&mut self, on: bool)
pub fn set_graph_x_log(&mut self, on: bool)
Enable or disable a log10 X axis (alias for set_x_log).
Sourcepub fn is_x_logarithmic(&self) -> bool
pub fn is_x_logarithmic(&self) -> bool
Return true if the X axis is logarithmic.
Sourcepub fn is_graph_x_log(&self) -> bool
pub fn is_graph_x_log(&self) -> bool
Return true if the X axis is logarithmic (alias for is_x_logarithmic).
Sourcepub fn set_y_log(&mut self, on: bool)
pub fn set_y_log(&mut self, on: bool)
Enable or disable a log10 Y axis. Limits must be strictly positive when on.
Sourcepub fn set_graph_y_log(&mut self, on: bool)
pub fn set_graph_y_log(&mut self, on: bool)
Enable or disable a log10 Y axis (alias for set_y_log).
Sourcepub fn is_y_logarithmic(&self) -> bool
pub fn is_y_logarithmic(&self) -> bool
Return true if the Y axis is logarithmic.
Sourcepub fn is_graph_y_log(&self) -> bool
pub fn is_graph_y_log(&self) -> bool
Return true if the Y axis is logarithmic (alias for is_y_logarithmic).
Sourcepub fn set_x_inverted(&mut self, on: bool)
pub fn set_x_inverted(&mut self, on: bool)
Invert the X axis direction (right-to-left).
Sourcepub fn is_x_inverted(&self) -> bool
pub fn is_x_inverted(&self) -> bool
Return true if the X axis is inverted.
Sourcepub fn set_x_min_range(&mut self, min: Option<f64>)
pub fn set_x_min_range(&mut self, min: Option<f64>)
Minimum allowed X span (prevents zooming in below this width).
Sourcepub fn set_x_max_range(&mut self, max: Option<f64>)
pub fn set_x_max_range(&mut self, max: Option<f64>)
Maximum allowed X span (prevents zooming out above this width).
Sourcepub fn set_x_min_pos(&mut self, min: Option<f64>)
pub fn set_x_min_pos(&mut self, min: Option<f64>)
Minimum allowed X lower bound (prevents panning below this value).
Sourcepub fn set_x_max_pos(&mut self, max: Option<f64>)
pub fn set_x_max_pos(&mut self, max: Option<f64>)
Maximum allowed X upper bound (prevents panning above this value).
Sourcepub fn set_y_min_range(&mut self, min: Option<f64>)
pub fn set_y_min_range(&mut self, min: Option<f64>)
Minimum allowed Y span (prevents zooming in below this height).
Sourcepub fn set_y_max_range(&mut self, max: Option<f64>)
pub fn set_y_max_range(&mut self, max: Option<f64>)
Maximum allowed Y span (prevents zooming out above this height).
Sourcepub fn set_y_min_pos(&mut self, min: Option<f64>)
pub fn set_y_min_pos(&mut self, min: Option<f64>)
Minimum allowed Y lower bound (prevents panning below this value).
Sourcepub fn set_y_max_pos(&mut self, max: Option<f64>)
pub fn set_y_max_pos(&mut self, max: Option<f64>)
Maximum allowed Y upper bound (prevents panning above this value).
Sourcepub fn x_constraints(&self) -> AxisConstraints
pub fn x_constraints(&self) -> AxisConstraints
Read back current X axis constraints.
Sourcepub fn y_constraints(&self) -> AxisConstraints
pub fn y_constraints(&self) -> AxisConstraints
Read back current Y axis constraints.
Sourcepub fn set_y_inverted(&mut self, on: bool)
pub fn set_y_inverted(&mut self, on: bool)
Invert the Y axis direction (top-to-bottom, as in image coordinates).
Sourcepub fn is_y_inverted(&self) -> bool
pub fn is_y_inverted(&self) -> bool
Return true if the Y axis is inverted.
Sourcepub fn set_x_tick_count(&mut self, n: Option<usize>)
pub fn set_x_tick_count(&mut self, n: Option<usize>)
Set the maximum number of major ticks on the X axis.
The chrome calls nice_ticks with this
cap, so the actual count may be lower to keep round step sizes.
Pass None to restore the default (8 ticks).
Sourcepub fn x_tick_count(&self) -> Option<usize>
pub fn x_tick_count(&self) -> Option<usize>
Return the current X tick-count cap, or None for the default (8).
Sourcepub fn set_y_tick_count(&mut self, n: Option<usize>)
pub fn set_y_tick_count(&mut self, n: Option<usize>)
Set the maximum number of major ticks on the Y axis.
Pass None to restore the default (6 ticks).
Sourcepub fn y_tick_count(&self) -> Option<usize>
pub fn y_tick_count(&self) -> Option<usize>
Return the current Y tick-count cap, or None for the default (6).
Sourcepub fn set_keep_data_aspect_ratio(&mut self, on: bool)
pub fn set_keep_data_aspect_ratio(&mut self, on: bool)
Keep data square on screen by expanding the tighter axis’ display range.
pub fn is_keep_data_aspect_ratio(&self) -> bool
pub fn set_axes_margins(&mut self, margins: Margins)
pub fn axes_margins(&self) -> Margins
pub fn set_graph_title(&mut self, title: impl Into<String>)
pub fn graph_title(&self) -> Option<&str>
pub fn clear_graph_title(&mut self)
pub fn set_graph_x_label(&mut self, label: impl Into<String>)
pub fn graph_x_label(&self) -> Option<&str>
pub fn clear_graph_x_label(&mut self)
pub fn set_graph_y_label(&mut self, label: impl Into<String>, axis: YAxis)
pub fn graph_y_label(&self, axis: YAxis) -> Option<&str>
pub fn clear_graph_y_label(&mut self, axis: YAxis)
pub fn set_foreground_colors(&mut self, foreground: Color32, grid: Color32)
pub fn set_background_colors( &mut self, background: Color32, data_background: Color32, )
pub fn data_background_color(&self) -> Color32
pub fn foreground_color(&self) -> Option<Color32>
pub fn grid_color(&self) -> Option<Color32>
pub fn set_graph_grid(&mut self, on: bool)
pub fn graph_grid(&self) -> bool
pub fn set_graph_grid_mode(&mut self, mode: GraphGrid)
pub fn graph_grid_mode(&self) -> GraphGrid
Sourcepub fn show_colorbar(&self) -> bool
pub fn show_colorbar(&self) -> bool
Whether the built-in colorbar is drawn when the plot has a colormap
(silx colorbar visibility). Defaults to true.
Sourcepub fn set_show_colorbar(&mut self, show: bool)
pub fn set_show_colorbar(&mut self, show: bool)
Set whether the built-in colorbar is drawn when the plot has a colormap.
Composite views that render their own dedicated colorbar (e.g.
ImageView) set this false on their internal image plot so the
colorbar is not drawn twice.
Sourcepub fn interactive_colorbar(&self) -> bool
pub fn interactive_colorbar(&self) -> bool
Whether the colorbar is the interactive pyqtgraph-style histogram colorbar
(drag the handles to set the colormap vmin/vmax) rather than a static
strip. See Self::set_interactive_colorbar.
Sourcepub fn set_interactive_colorbar(&mut self, interactive: bool)
pub fn set_interactive_colorbar(&mut self, interactive: bool)
Make the colorbar an interactive histogram colorbar (drag-to-set-levels).
The drag is surfaced via PlotResponse::colorbar_dragged_levels for the
caller to apply to the colormap (and re-upload the image); supply the
value-distribution histogram with Self::set_colorbar_histogram and the
axis range with Self::set_colorbar_value_range.
Sourcepub fn set_colorbar_histogram(
&mut self,
histogram: Option<(Vec<u64>, Vec<f64>)>,
)
pub fn set_colorbar_histogram( &mut self, histogram: Option<(Vec<u64>, Vec<f64>)>, )
Set the value-distribution histogram drawn beside the interactive
colorbar’s gradient ((counts, edges) from
crate::core::histogram::compute_histogram); None draws gradient +
handles only.
Sourcepub fn set_colorbar_value_range(&mut self, range: Option<(f64, f64)>)
pub fn set_colorbar_value_range(&mut self, range: Option<(f64, f64)>)
Set the value range (min, max) the interactive colorbar’s axis spans
(handles move within it); None falls back to the colormap’s
vmin/vmax.
pub fn set_graph_minor_grid(&mut self, on: bool)
pub fn graph_minor_grid(&self) -> bool
pub fn default_colormap(&self) -> &Colormap
pub fn set_default_colormap(&mut self, colormap: Colormap)
pub fn colorbar_colormap(&self) -> Option<&Colormap>
Sourcepub fn get_image_pixels_raw(&self) -> Option<Vec<f64>>
pub fn get_image_pixels_raw(&self) -> Option<Vec<f64>>
The active image’s raw scalar pixels as f64, row-major (silx
ImageData.getData), or None when the active item is not a scalar
image with retained data.
Used by Self::autoscale_active_image to drive a raw-pixel autoscale,
and exposed so callers can compute their own value statistics over the
exact pixels the image was uploaded with (NaN-preserving).
Sourcepub fn autoscale_active_image(
&mut self,
mode: AutoscaleMode,
) -> Option<(f64, f64)>
pub fn autoscale_active_image( &mut self, mode: AutoscaleMode, ) -> Option<(f64, f64)>
Autoscale the active image’s colormap value limits from its raw pixels
using mode (silx ColormapDialog Stddev3 / Percentile autoscale,
ColormapDialog.py:450-480).
Computes the (vmin, vmax) range over the active image’s raw scalar
pixels (NaN-ignoring; AutoscaleMode::Stddev3 = mean ± 3·std,
AutoscaleMode::Percentile = the colormap’s percentile pair), then
re-uploads the image with a colormap carrying those limits (preserving
the LUT / normalization / gamma). Returns the applied (vmin, vmax), or
None when the active item is not a scalar image with retained data.
Sourcepub fn set_active_image_levels(&mut self, vmin: f64, vmax: f64) -> bool
pub fn set_active_image_levels(&mut self, vmin: f64, vmax: f64) -> bool
Set the active image’s colormap value limits to an explicit (vmin, vmax),
re-uploading the image with those levels (preserving the LUT /
normalization / gamma / geometry, like Self::autoscale_active_image).
This is the apply path for the interactive colorbar drag: feed the
(vmin, vmax) from PlotResponse::colorbar_dragged_levels back here so a
bare Plot2D/Plot1D updates its contrast live. Returns true when a
scalar image with retained data was updated, false otherwise.
Sourcepub fn image_alpha(&self, handle: ItemHandle) -> Option<f32>
pub fn image_alpha(&self, handle: ItemHandle) -> Option<f32>
The global opacity of the scalar image at handle (silx image
getAlpha, AlphaMixIn), or None when the item is not a scalar image
with retained data.
This is the read side of the AlphaSlider
item bindings (ActiveImageAlphaSlider/NamedItemAlphaSlider):
getItem().getAlpha(). Only images carry a retained, re-applicable
alpha — curves bake opacity into their color and scatters retain no
data, so neither is addressable here (the bindings disable for them,
mirroring silx’s “no item → disabled” rule).
Sourcepub fn set_image_alpha(&mut self, handle: ItemHandle, alpha: f32) -> bool
pub fn set_image_alpha(&mut self, handle: ItemHandle, alpha: f32) -> bool
Set the global opacity of the scalar image at handle, re-uploading it
with the new alpha and the same pixels / geometry / colormap (silx image
setAlpha, AlphaMixIn). Returns true when a scalar image with
retained data was updated, false otherwise.
alpha is clamped to [0, 1] (silx AlphaMixIn.setAlpha). This is the
write side of the ActiveImageAlphaSlider/NamedItemAlphaSlider
bindings (getItem().setAlpha(value)).
Sourcepub fn active_image_handle(&self) -> Option<ItemHandle>
pub fn active_image_handle(&self) -> Option<ItemHandle>
The active item’s handle when it is a scalar image with retained data,
else None (silx getActiveImage() restricted to images that carry an
addressable alpha). Used by ActiveImageAlphaSlider to detect when the
active-image binding changes and re-seed the slider from the new item.
Sourcepub fn active_image_alpha(&self) -> Option<f32>
pub fn active_image_alpha(&self) -> Option<f32>
The active image’s global opacity (silx ActiveImageAlphaSlider
getItem().getAlpha() = getActiveImage().getAlpha()), or None when
the active item is not a scalar image with retained data.
Sourcepub fn set_active_image_alpha(&mut self, alpha: f32) -> bool
pub fn set_active_image_alpha(&mut self, alpha: f32) -> bool
Set the active image’s global opacity (silx ActiveImageAlphaSlider
getItem().setAlpha(value)). Returns true when a scalar active image
was updated, false otherwise. alpha is clamped to [0, 1].
Sourcepub fn apply_median_filter(
&mut self,
kernel_width: usize,
conditional: bool,
) -> bool
pub fn apply_median_filter( &mut self, kernel_width: usize, conditional: bool, ) -> bool
Apply a median filter to the active image and replace it in place (silx
MedianFilterAction / MedianFilter2DAction re-adding the filtered image
with addImage(replace=True)).
Reads the active image’s raw scalar pixels and geometry, runs
crate::widget::actions::analysis::median_filter_2d with a square
(kernel_width, kernel_width) kernel (silx MedianFilter2DAction) and
the default mode='nearest' edge handling, then re-uploads the result
with the same origin / scale / colormap. kernel_width is forced odd
(silx MedianFilterDialog spinbox step 2, min 1) by rounding up to the
next odd value; a width of 1 (or 0) leaves the image unchanged.
Returns true if a scalar image was filtered and replaced, or false
when the active item is not a scalar image with retained data.
Sourcepub fn apply_median_filter_1d(
&mut self,
kernel_width: usize,
conditional: bool,
) -> bool
pub fn apply_median_filter_1d( &mut self, kernel_width: usize, conditional: bool, ) -> bool
Apply a 1D median filter to the active image (silx MedianFilter1DAction,
kernel (kernel_width, 1)), replacing it in place.
Same contract as Self::apply_median_filter but with a column-1 kernel
that filters along image rows (the height / y direction).
Sourcepub fn active_image_histogram(
&self,
n_bins: Option<usize>,
) -> Option<PixelHistogram>
pub fn active_image_histogram( &self, n_bins: Option<usize>, ) -> Option<PixelHistogram>
Compute the pixel-intensity histogram of the active image (silx
PixelIntensitiesHistoAction).
Reads the active image’s raw scalar pixels and runs
crate::widget::actions::analysis::pixel_intensity_histogram with the
silx defaults (bin count min(1024, floor(sqrt(finite_count))), finite
range, last_bin_closed, non-finite excluded). Pass n_bins to override
the bin count (mirroring the widget’s editable bin-count field), or
None for the silx default.
Returns None when the active item is not a scalar image with retained
data, or when the image has no finite pixel.
pub fn set_graph_cursor(&mut self, on: bool)
pub fn graph_cursor(&self) -> bool
pub fn data_to_pixel(&self, x: f64, y: f64, axis: YAxis) -> Option<Pos2>
pub fn pixel_to_data(&self, p: Pos2, axis: YAxis) -> Option<(f64, f64)>
pub fn plot_bounds_in_pixels(&self) -> Option<Rect>
Sourcepub fn snap_cursor(&self, cursor: [f64; 2], mode: SnappingMode) -> Option<Snap>
pub fn snap_cursor(&self, cursor: [f64; 2], mode: SnappingMode) -> Option<Snap>
Snap the data-space cursor to the nearest data point under the live
mode, porting silx PositionInfo._updateStatusBar’s snap
(PositionInfo.py:196-292) against this widget’s retained items.
Builds a SnapItem per item (kind, is_item_visible, whether it shows
a symbol, whether it is the active item), runs snapping_candidates to
pick the participating items for mode, projects every candidate’s
retained vertices to pixels through the cached display transform
(axis-aware, so a y2 curve snaps in its own axis), and returns the
snap_to_nearest result within SNAP_THRESHOLD_DIST logical pixels —
its data is the snapped coordinate to show in a PositionInfo, with a
None result meaning “no snap” (feed false to
PositionInfo::ui_snapped).
Curves, histograms, and scatters all participate: each is stored with
retained RetainedItemData::Curve { x, y } vertices (a scatter is a
symbol-only curve-kind item, Self::add_scatter), so a SCATTER-mode
snap matches scatter points and a CURVE-mode snap matches curve and
histogram vertices. Items whose data is not retained as vertices (images,
triangles, shapes, markers) classify as SnapItemKind::Other and are
never candidates.
Returns None when snapping is not engaged (no CURVE/SCATTER flag),
nothing is within the radius, or no frame has been rendered yet (the
transform is uncached). The SnappingMode::CROSSHAIR gate is the
caller’s precondition (silx :198), as is the empty/None-cursor case.
pub fn add_roi(&mut self, roi: Roi) -> usize
pub fn rois(&self) -> &[ManagedRoi]
pub fn rois_mut(&mut self) -> &mut [ManagedRoi]
pub fn clear_rois(&mut self)
Sourcepub fn remove_roi(&mut self, index: usize)
pub fn remove_roi(&mut self, index: usize)
Remove the ROI at index, keeping the current-ROI selection consistent
via the Plot owner (silx RegionOfInterestManager.removeRoi). Emits
PlotEvent::RoiAboutToBeRemoved before the removal (silx
sigRoiAboutToBeRemoved), so a listener can still read the ROI being
dropped; an out-of-range index is ignored (no event).
Sourcepub fn add_managed_roi(&mut self, managed: ManagedRoi) -> usize
pub fn add_managed_roi(&mut self, managed: ManagedRoi) -> usize
Append a fully-specified ManagedRoi (geometry + appearance) and
return its index, emitting PlotEvent::RoiAdded (silx
RegionOfInterestManager.addRoi → sigRoiAdded). Use this to add a
styled/named ROI in one call; Self::add_roi adds bare geometry with
default appearance.
Sourcepub fn ruler_active(&self) -> bool
pub fn ruler_active(&self) -> bool
Whether the ruler measurement tool is armed (silx
RulerToolButton.isChecked).
Sourcepub fn ruler_roi(&self) -> Option<usize>
pub fn ruler_roi(&self) -> Option<usize>
The index of the live ruler line ROI in rois, or None
when no ruler line has been drawn (or the ruler is disarmed).
Sourcepub fn set_ruler_active(&mut self, active: bool)
pub fn set_ruler_active(&mut self, active: bool)
Arm or disarm the ruler measurement tool (silx RulerToolButton toggle).
Arming enters a line-ROI draw
(PlotInteractionMode::RoiCreate(RoiDrawKind::Line)),
remembering the prior mode; each completed drag draws a line ROI whose
name is its measured length (RulerToolButton::distance_text), recomputed
in show — a new measurement replaces the previous ruler
line. Disarming removes the ruler line and restores the prior interaction
mode (silx deselect). A no-op if already in the requested state.
Sourcepub fn roi_interaction_mode(&self, index: usize) -> Option<RoiInteractionMode>
pub fn roi_interaction_mode(&self, index: usize) -> Option<RoiInteractionMode>
The current handle-editing interaction mode of the ROI at index (silx
InteractionModeMixIn.getInteractionMode). None for an out-of-range
index or a ROI kind without interaction modes (everything but Arc/Band).
Sourcepub fn set_roi_interaction_mode(
&mut self,
index: usize,
mode: RoiInteractionMode,
) -> bool
pub fn set_roi_interaction_mode( &mut self, index: usize, mode: RoiInteractionMode, ) -> bool
Switch the interaction mode of the ROI at index (silx
InteractionModeMixIn.setInteractionMode). Emits
PlotEvent::RoiInteractionModeChanged and returns true only when the
index is valid and mode is one of that ROI’s
Roi::available_interaction_modes;
an out-of-range index or a mode foreign to the kind is ignored (no event).
Sourcepub fn set_roi_color(&mut self, index: usize, color: Color32)
pub fn set_roi_color(&mut self, index: usize, color: Color32)
Set the per-ROI color override at index (silx RegionOfInterest.setColor).
An out-of-range index is ignored.
Sourcepub fn set_roi_name(&mut self, index: usize, name: impl Into<String>)
pub fn set_roi_name(&mut self, index: usize, name: impl Into<String>)
Set the display name of the ROI at index (silx RegionOfInterest.setName).
An out-of-range index is ignored.
Sourcepub fn set_roi_line_width(&mut self, index: usize, width: f32)
pub fn set_roi_line_width(&mut self, index: usize, width: f32)
Set the outline line width of the ROI at index (silx
RegionOfInterest.setLineWidth). An out-of-range index is ignored.
Sourcepub fn set_roi_line_style(&mut self, index: usize, style: RoiLineStyle)
pub fn set_roi_line_style(&mut self, index: usize, style: RoiLineStyle)
Set the outline stroke style of the ROI at index (silx
RegionOfInterest.setLineStyle). An out-of-range index is ignored.
Sourcepub fn set_roi_line_gap_color(
&mut self,
index: usize,
gap_color: Option<Color32>,
)
pub fn set_roi_line_gap_color( &mut self, index: usize, gap_color: Option<Color32>, )
Set the gap fill color of a dashed/dotted ROI outline at index (silx
LineMixIn.setLineGapColor); None leaves the gaps transparent. Only
visible on a dashed/dotted line style. An out-of-range index is ignored.
Sourcepub fn set_roi_fill(&mut self, index: usize, fill: bool)
pub fn set_roi_fill(&mut self, index: usize, fill: bool)
Set whether the ROI at index fills its interior (silx
RegionOfInterest.setFill). An out-of-range index is ignored.
Sourcepub fn current_roi(&self) -> Option<usize>
pub fn current_roi(&self) -> Option<usize>
The index of the current/highlighted ROI, or None (silx
RegionOfInterestManager.getCurrentRoi).
Sourcepub fn set_current_roi(&mut self, index: Option<usize>)
pub fn set_current_roi(&mut self, index: Option<usize>)
Set the current/highlighted ROI by index, or None to clear it (silx
RegionOfInterestManager.setCurrentRoi). Highlights exactly that ROI on
the plot; an out-of-range index clears the selection. Emits
PlotEvent::CurrentRoiChanged when the current ROI actually changes
(silx sigCurrentRoiChanged).
Sourcepub fn show_roi_manager(&mut self, ui: &mut Ui) -> Option<usize>
pub fn show_roi_manager(&mut self, ui: &mut Ui) -> Option<usize>
Show a compact ROI manager panel: a table listing all current ROIs — each
row carries an editable name (silx label column), the geometry shown as a
make-current selector (silx row selection → sigCurrentRoiChanged,
highlighted when current), and a remove button — followed by buttons to add
each ROI kind and a clear-all button. Mirrors silx
RegionOfInterestTableWidget / RegionOfInterestManager.
Per-row edits are routed through the owner APIs (Self::set_roi_name,
Self::set_current_roi, Self::remove_roi) so events fire and the
current-ROI index stays consistent.
New ROIs are centered on the current plot view. Returns the index of any
newly added ROI, or None when none was added this frame.
pub fn pick_item(&self, p: Pos2, item: ItemHandle) -> Option<PickResult>
pub fn items_back_to_front(&self) -> Vec<ItemHandle> ⓘ
pub fn replot(&mut self)
pub fn save_graph(&self, path: &Path, size: (u32, u32)) -> Result<(), SaveError>
Sourcepub fn save_graph_with_format(
&self,
path: &Path,
size: (u32, u32),
format: SaveFormat,
dpi: u32,
) -> Result<(), SaveError>
pub fn save_graph_with_format( &self, path: &Path, size: (u32, u32), format: SaveFormat, dpi: u32, ) -> Result<(), SaveError>
Render the figure to path in the given SaveFormat at dpi,
generalizing Self::save_graph (PNG-only) over silx’s raster save
formats (PNG/PPM/SVG/TIFF) plus the raster-embedding EPS/PDF. Faithful to silx
BackendBase.saveGraph(fileName, fileFormat, dpi). The GPU readback +
file write are native shims; the per-format encoding is unit-tested in
crate::render::save.
Sourcepub fn save_to_path(
&self,
path: &Path,
size: (u32, u32),
) -> Result<bool, SaveError>
pub fn save_to_path( &self, path: &Path, size: (u32, u32), ) -> Result<bool, SaveError>
Save to path, dispatching by its extension (silx SaveAction):
a .csv path writes the active curve’s (x, y) data; a figure
extension (png/ppm/svg/tif/tiff/eps/pdf) renders the figure
to a size pixel image in the matching SaveFormat. Returns Ok(true) when a file
was written, Ok(false) when the path’s extension is not a recognized save
target or (for CSV) there is no active curve to save.
All recognized figure formats are routed through
Self::save_graph_with_format at DEFAULT_SAVE_DPI; PNG remains
byte-identical to Self::save_graph (both go through
crate::render::save::encode_png). The extension-to-target decision is
the pure, unit-tested SaveTarget::from_path.
Sourcepub fn save_dialog(&self, size: (u32, u32)) -> Result<bool, SaveError>
pub fn save_dialog(&self, size: (u32, u32)) -> Result<bool, SaveError>
Open a native save-file dialog (silx SaveAction file dialog) and save
the figure or active-curve data to the chosen path via
Self::save_to_path. Returns Ok(true) when a file was written,
Ok(false) when the dialog was cancelled or the chosen path was not a
recognized target. The dialog is a native shim; the save logic it calls is
covered by unit tests.
Sourcepub fn save_rois_to_path(&self, path: impl AsRef<Path>) -> Result<()>
pub fn save_rois_to_path(&self, path: impl AsRef<Path>) -> Result<()>
Save the current ROIs to path in the siplot ROI text format (silx
CurvesROIWidget.save(filename)) via crate::save_rois. The encoder
is unit-tested (core::roi_io); this is the widget-level wrapper.
Sourcepub fn load_rois_from_path(&mut self, path: impl AsRef<Path>) -> Result<()>
pub fn load_rois_from_path(&mut self, path: impl AsRef<Path>) -> Result<()>
Replace the current ROIs with those loaded from path (silx
CurvesROIWidget.load(filename)) via crate::load_rois. The previous
set is cleared first, so this emits PlotEvent::RoisCleared followed by
one PlotEvent::RoiAdded per loaded ROI.
Sourcepub fn save_rois_dialog(&self) -> Result<bool>
pub fn save_rois_dialog(&self) -> Result<bool>
Open a native save-file dialog (silx CurvesROIWidget save button) and
write the current ROIs to the chosen path via Self::save_rois_to_path.
Returns Ok(true) when a file was written, Ok(false) on cancel. The
dialog is a native shim; the save logic it calls is unit-tested.
Sourcepub fn load_rois_dialog(&mut self) -> Result<bool>
pub fn load_rois_dialog(&mut self) -> Result<bool>
Open a native open-file dialog (silx CurvesROIWidget load button) and
replace the current ROIs with those from the chosen path via
Self::load_rois_from_path. Returns Ok(true) when a file was loaded,
Ok(false) on cancel. The dialog is a native shim.
Sourcepub fn copy_to_clipboard(&self, size: (u32, u32)) -> Result<bool, SaveError>
pub fn copy_to_clipboard(&self, size: (u32, u32)) -> Result<bool, SaveError>
Copy a size pixel snapshot of the figure to the system clipboard as an
image (silx CopyAction, which renders the plot to a bitmap and calls
QApplication.clipboard().setImage).
The figure is rendered to a PNG (the only in-memory figure encoding
available), decoded back to RGBA via
decode_png_to_rgba,
shaped into an arboard::ImageData via
rgba_to_clipboard_image,
then placed on the clipboard. The GPU readback and the clipboard call are
untested native shims; the PNG-decode and RGBA-shaping logic between them
is unit-tested.
Sourcepub fn print_graph(&self, size: (u32, u32)) -> Result<bool, SaveError>
pub fn print_graph(&self, size: (u32, u32)) -> Result<bool, SaveError>
Print a size pixel snapshot of the figure to the default system printer
(silx PrintAction.printPlot).
Mirrors silx’s raster print path: silx renders the plot to a PNG
(_plotAsPNG) and draws that bitmap onto the printer via
QPainter/QPrinter — not vector graphics. Here the figure is rasterized
to a temp PNG via Self::save_graph (the only public figure-encoding
entry point), then submitted to the default printer with the
printers crate. Returns Ok(true) when a print job was queued,
Ok(false) when no default printer is available (the silx
getDefaultPrinter analogue).
The GPU readback and the printer submission are untested native shims (a
real printer / spooler is required); the rasterization step reuses the
unit-tested crate::render::save encoders, and the temp-path naming is
unit-tested via print_temp_png_path. The toolbar Print button opens a
printer-selection dialog (crate::widget::print_dialog::PrintDialog)
that routes to Self::print_graph_to; this method is the
dialog-less direct path to the default printer.
Sourcepub fn print_graph_to(
&self,
printer_name: &str,
size: (u32, u32),
) -> Result<bool, SaveError>
pub fn print_graph_to( &self, printer_name: &str, size: (u32, u32), ) -> Result<bool, SaveError>
Print a size pixel snapshot of the figure to the system printer with
the given system name (the print dialog’s chosen target). Returns
Ok(false) when no printer of that name exists (e.g. it disappeared
between the dialog opening and the click).
Sourcepub fn reset_zoom_to_data(&mut self)
pub fn reset_zoom_to_data(&mut self)
Apply accumulated data bounds to the current view.
Trait Implementations§
Source§impl Deref for ScatterView
impl Deref for ScatterView
Auto Trait Implementations§
impl !RefUnwindSafe for ScatterView
impl !UnwindSafe for ScatterView
impl Freeze for ScatterView
impl Send for ScatterView
impl Sync for ScatterView
impl Unpin for ScatterView
impl UnsafeUnpin for ScatterView
Blanket Implementations§
Source§impl<T> BorrowMut<T> for Twhere
T: ?Sized,
impl<T> BorrowMut<T> for Twhere
T: ?Sized,
Source§fn borrow_mut(&mut self) -> &mut T
fn borrow_mut(&mut self) -> &mut T
impl<ST, DT> CastableFrom<ST, Initialized, Initialized> for DT
impl<ST, DT> CastableFrom<ST, Uninit, Uninit> for DT
Source§impl<T> Downcast for Twhere
T: Any,
impl<T> Downcast for Twhere
T: Any,
Source§fn into_any(self: Box<T>) -> Box<dyn Any>
fn into_any(self: Box<T>) -> Box<dyn Any>
Box<dyn Trait> (where Trait: Downcast) to Box<dyn Any>. Box<dyn Any> can
then be further downcast into Box<ConcreteType> where ConcreteType implements Trait.Source§fn into_any_rc(self: Rc<T>) -> Rc<dyn Any>
fn into_any_rc(self: Rc<T>) -> Rc<dyn Any>
Rc<Trait> (where Trait: Downcast) to Rc<Any>. Rc<Any> can then be
further downcast into Rc<ConcreteType> where ConcreteType implements Trait.Source§fn as_any(&self) -> &(dyn Any + 'static)
fn as_any(&self) -> &(dyn Any + 'static)
&Trait (where Trait: Downcast) to &Any. This is needed since Rust cannot
generate &Any’s vtable from &Trait’s.Source§fn as_any_mut(&mut self) -> &mut (dyn Any + 'static)
fn as_any_mut(&mut self) -> &mut (dyn Any + 'static)
&mut Trait (where Trait: Downcast) to &Any. This is needed since Rust cannot
generate &mut Any’s vtable from &mut Trait’s.