pub struct HistogramColorBar {
pub colormap: Colormap,
pub data_range: (f64, f64),
pub histogram: Option<(Vec<u64>, Vec<f64>)>,
pub vmin: f64,
pub vmax: f64,
pub bar_bounds: Option<(f32, f32)>,
}Expand description
An interactive histogram colorbar. Built fresh each frame by its owner from
the active colormap, the image’s value range, the value-distribution
histogram, and the current vmin/vmax.
Fields§
§colormap: ColormapThe colormap whose gradient and LUT are shown.
data_range: (f64, f64)The image’s value range (min, max); the axis is derived from this via
axis_range.
histogram: Option<(Vec<u64>, Vec<f64>)>(counts, edges) from crate::core::histogram::compute_histogram, or
None to draw the gradient + handles without a histogram.
vmin: f64Current low level (drawn as the bottom handle).
vmax: f64Current high level (drawn as the top handle).
bar_bounds: Option<(f32, f32)>Absolute screen (top, bottom) the gradient strip + histogram + handles
should span, so the bar aligns with an external reference (the owning
image’s data-area guides). None falls back to the allocated box inset by
V_INSET. Set by the owner from the image plot’s data-area rect.
Implementations§
Source§impl HistogramColorBar
impl HistogramColorBar
Sourcepub fn new(colormap: Colormap) -> Self
pub fn new(colormap: Colormap) -> Self
A histogram colorbar for colormap, taking the levels from the colormap’s
vmin/vmax and the data range likewise (override with the builders).
Sourcepub fn with_data_range(self, range: (f64, f64)) -> Self
pub fn with_data_range(self, range: (f64, f64)) -> Self
Set the image’s value range (builder form).
Sourcepub fn with_histogram(self, histogram: Option<(Vec<u64>, Vec<f64>)>) -> Self
pub fn with_histogram(self, histogram: Option<(Vec<u64>, Vec<f64>)>) -> Self
Set the value-distribution histogram (builder form).
Sourcepub fn with_levels(self, vmin: f64, vmax: f64) -> Self
pub fn with_levels(self, vmin: f64, vmax: f64) -> Self
Set the current levels (builder form).
Sourcepub fn with_bar_bounds(self, top: f32, bottom: f32) -> Self
pub fn with_bar_bounds(self, top: f32, bottom: f32) -> Self
Pin the gradient strip (and histogram/handles) to absolute screen
(top, bottom), so the bar lines up with the owning image’s data-area
guides instead of filling its allocated box (builder form).
Sourcepub fn ui(&self, ui: &mut Ui, desired: Vec2) -> HistogramColorBarResponse
pub fn ui(&self, ui: &mut Ui, desired: Vec2) -> HistogramColorBarResponse
Paint the histogram + gradient + draggable handles into a desired-sized
region of ui and report any handle drag this frame. The column senses
clicks so a right-click opens the Auto-range context menu.
Sourcepub fn ui_at(&self, ui: &Ui, rect: Rect) -> HistogramColorBarResponse
pub fn ui_at(&self, ui: &Ui, rect: Rect) -> HistogramColorBarResponse
Render at an explicit rect instead of allocating from the layout cursor,
for embedding in a fixed gutter — e.g. a plot’s colorbar region in
crate::widget::plot_widget::PlotView. Same interaction and paint as
Self::ui; pair with Self::with_bar_bounds when the gutter is taller
than the data area it should track.
Trait Implementations§
Source§impl Clone for HistogramColorBar
impl Clone for HistogramColorBar
Source§fn clone(&self) -> HistogramColorBar
fn clone(&self) -> HistogramColorBar
1.0.0 (const: unstable) · Source§fn clone_from(&mut self, source: &Self)
fn clone_from(&mut self, source: &Self)
source. Read moreAuto Trait Implementations§
impl Freeze for HistogramColorBar
impl RefUnwindSafe for HistogramColorBar
impl Send for HistogramColorBar
impl Sync for HistogramColorBar
impl Unpin for HistogramColorBar
impl UnsafeUnpin for HistogramColorBar
impl UnwindSafe for HistogramColorBar
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> CloneToUninit for Twhere
T: Clone,
impl<T> CloneToUninit for Twhere
T: Clone,
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.