pub struct PriceMap { /* private fields */ }Expand description
Per-frame price-to-pixel mapping.
Unclamped: a price outside the visible range maps outside the pane, and the painter’s clip rect clips it.
Implementations§
Source§impl PriceMap
impl PriceMap
Sourcepub fn new(
transform: PriceTransform,
range: PriceRange,
top: f32,
bottom: f32,
inverted: bool,
) -> Self
pub fn new( transform: PriceTransform, range: PriceRange, top: f32, bottom: f32, inverted: bool, ) -> Self
Maps range (scale units) onto top..bottom (points), the low end at the
bottom unless inverted.
Sourcepub fn with_bounds(self, top: f32, bottom: f32) -> Self
pub fn with_bounds(self, top: f32, bottom: f32) -> Self
Uses the same scale, orientation and formatting in a different vertical plot area.
Sourcepub fn with_price_precision(self, decimals: Option<u8>) -> Self
pub fn with_price_precision(self, decimals: Option<u8>) -> Self
Sets the price precision for this frame.
Sourcepub fn with_tick_marks(self, config: PriceMarkGeneratorConfig) -> Self
pub fn with_tick_marks(self, config: PriceMarkGeneratorConfig) -> Self
Sets how marks spaces the tick marks.
Sourcepub fn marks(&self) -> Vec<PriceMark>
pub fn marks(&self) -> Vec<PriceMark>
Tick marks for the visible range, spaced by the scale’s
tick_marks settings. The labels of a chart’s maps write
prices of four or more integer digits with its ChartConfig::thousands_sep.
Sourcepub fn price_precision(&self) -> Option<usize>
pub fn price_precision(&self) -> Option<usize>
Supplied price decimals, or None to derive them from the tick step.
Percentage and indexed axes keep their own precision.
Sourcepub fn transform(&self) -> PriceTransform
pub fn transform(&self) -> PriceTransform
Returns the price transform.
Sourcepub fn range(&self) -> PriceRange
pub fn range(&self) -> PriceRange
Returns the visible range in scale units.
Sourcepub fn price_to_y(&self, price: f64) -> f32
pub fn price_to_y(&self, price: f64) -> f32
Converts a price to a y coordinate.
Sourcepub fn y_to_price(&self, y: f32) -> f64
pub fn y_to_price(&self, y: f32) -> f64
Converts a y coordinate to a price.
Trait Implementations§
impl Copy for PriceMap
impl StructuralPartialEq for PriceMap
Auto Trait Implementations§
impl Freeze for PriceMap
impl RefUnwindSafe for PriceMap
impl Send for PriceMap
impl Sync for PriceMap
impl Unpin for PriceMap
impl UnsafeUnpin for PriceMap
impl UnwindSafe for PriceMap
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