pub struct ProgressDimensions { /* private fields */ }Expand description
ProgressDimensions - Centralizes ALL progress bar and chart mathematical operations
Eliminates ad hoc progress math like:
- filled_width = ((bar_width as f64) * progress).round() as usize
- Chart scaling and data mapping scattered throughout chart components
- Progress indicator positioning and sizing calculations
Replaces scattered progress logic from progress_bar.rs, chart_component.rs
Implementations§
Source§impl ProgressDimensions
impl ProgressDimensions
Sourcepub fn new(bounds: Bounds, orientation: Orientation) -> Self
pub fn new(bounds: Bounds, orientation: Orientation) -> Self
Create new progress dimensions
Sourcepub fn set_progress(&mut self, progress: f64)
pub fn set_progress(&mut self, progress: f64)
Set current progress (0.0 to 1.0)
Sourcepub fn set_data_range(&mut self, min: f64, max: f64)
pub fn set_data_range(&mut self, min: f64, max: f64)
Set data range for value mapping
Sourcepub fn calculate_fill_size(&self) -> usize
pub fn calculate_fill_size(&self) -> usize
Calculate filled area size based on progress Centralizes: filled_width = ((bar_width as f64) * progress).round() as usize
Sourcepub fn get_fill_bounds(&self) -> Bounds
pub fn get_fill_bounds(&self) -> Bounds
Get filled area bounds for drawing
Sourcepub fn get_empty_bounds(&self) -> Option<Bounds>
pub fn get_empty_bounds(&self) -> Option<Bounds>
Get unfilled area bounds for drawing
Sourcepub fn map_value_to_pixel(&self, value: f64) -> usize
pub fn map_value_to_pixel(&self, value: f64) -> usize
Map a data value to pixel position within bounds Centralizes chart data-to-pixel mapping
Sourcepub fn map_pixel_to_value(&self, pixel: usize) -> f64
pub fn map_pixel_to_value(&self, pixel: usize) -> f64
Map pixel position back to data value Useful for interactive charts
Sourcepub fn calculate_segments(&self, segment_count: usize) -> Vec<ProgressSegment>
pub fn calculate_segments(&self, segment_count: usize) -> Vec<ProgressSegment>
Calculate progress bar segment positions for multi-segment bars
Sourcepub fn calculate_axis_ticks(&self, tick_count: usize) -> Vec<AxisTick>
pub fn calculate_axis_ticks(&self, tick_count: usize) -> Vec<AxisTick>
Calculate chart axis tick positions Centralizes chart axis calculation
Sourcepub fn calculate_data_points(&self, data: &[f64]) -> Vec<DataPoint>
pub fn calculate_data_points(&self, data: &[f64]) -> Vec<DataPoint>
Calculate data point positions for line charts
Sourcepub fn calculate_bars(&self, data: &[f64]) -> Vec<ChartBar>
pub fn calculate_bars(&self, data: &[f64]) -> Vec<ChartBar>
Calculate bar chart bar positions and heights
Sourcepub fn calculate_sparkline(&self, data: &[f64]) -> Vec<SparklinePoint>
pub fn calculate_sparkline(&self, data: &[f64]) -> Vec<SparklinePoint>
Calculate sparkline positions (compact inline charts)
Sourcepub fn validate(&self) -> Result<(), ProgressDimensionError>
pub fn validate(&self) -> Result<(), ProgressDimensionError>
Validate progress dimensions are reasonable
Trait Implementations§
Source§impl Clone for ProgressDimensions
impl Clone for ProgressDimensions
Source§fn clone(&self) -> ProgressDimensions
fn clone(&self) -> ProgressDimensions
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 ProgressDimensions
impl RefUnwindSafe for ProgressDimensions
impl Send for ProgressDimensions
impl Sync for ProgressDimensions
impl Unpin for ProgressDimensions
impl UnsafeUnpin for ProgressDimensions
impl UnwindSafe for ProgressDimensions
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.