pub struct IndicatorCoordParams {
pub bar_spacing: f32,
pub right_offset: f64,
pub base_idx: usize,
pub start_idx: usize,
}Expand description
Coordinate parameters for aligning indicator panes with the main chart.
Wraps the parameters needed to construct a ChartMapping so that
indicator data points are drawn at the same x-positions as their
corresponding bars in the main chart. Obtained from the chart’s time scale
after rendering.
Fields§
§bar_spacing: f32Bar spacing in egui logical points.
right_offset: f64Right offset (bars to the right of last data point)
base_idx: usizeBase index (index of last data point)
start_idx: usizeStart index (index of first visible bar)
Implementations§
Source§impl IndicatorCoordParams
impl IndicatorCoordParams
Sourcepub fn new(
bar_spacing: f32,
right_offset: impl Into<f64>,
base_idx: usize,
start_idx: usize,
) -> Self
pub fn new( bar_spacing: f32, right_offset: impl Into<f64>, base_idx: usize, start_idx: usize, ) -> Self
Creates coordinate parameters from the main chart’s time-scale state.
These values are typically obtained from the chart after rendering via
crate::widget::Chart::get_chart_mapping.
Sourcepub fn to_mapping(&self, rect: Rect, y_min: f64, y_max: f64) -> ChartMapping
pub fn to_mapping(&self, rect: Rect, y_min: f64, y_max: f64) -> ChartMapping
Creates a ChartMapping from these params, the panel’s screen rect, and y-range.
The resulting mapping converts bar indices and price/indicator values to screen positions in egui logical points within the given rect.
Trait Implementations§
Source§impl Clone for IndicatorCoordParams
impl Clone for IndicatorCoordParams
Source§fn clone(&self) -> IndicatorCoordParams
fn clone(&self) -> IndicatorCoordParams
1.0.0 (const: unstable) · Source§fn clone_from(&mut self, source: &Self)
fn clone_from(&mut self, source: &Self)
source. Read moreimpl Copy for IndicatorCoordParams
Auto Trait Implementations§
impl Freeze for IndicatorCoordParams
impl RefUnwindSafe for IndicatorCoordParams
impl Send for IndicatorCoordParams
impl Sync for IndicatorCoordParams
impl Unpin for IndicatorCoordParams
impl UnsafeUnpin for IndicatorCoordParams
impl UnwindSafe for IndicatorCoordParams
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> IntoEither for T
impl<T> IntoEither for T
Source§fn into_either(self, into_left: bool) -> Either<Self, Self> ⓘ
fn into_either(self, into_left: bool) -> Either<Self, Self> ⓘ
self into a Left variant of Either<Self, Self>
if into_left is true.
Converts self into a Right variant of Either<Self, Self>
otherwise. Read moreSource§fn into_either_with<F>(self, into_left: F) -> Either<Self, Self> ⓘ
fn into_either_with<F>(self, into_left: F) -> Either<Self, Self> ⓘ
self into a Left variant of Either<Self, Self>
if into_left(&self) returns true.
Converts self into a Right variant of Either<Self, Self>
otherwise. Read more