pub struct ChartPoint {
pub bar_idx: f32,
pub price: f64,
/* private fields */
}Expand description
A persistent point stored as (bar_idx, price) for pan/zoom stability
A chart retains the timestamp behind each projected index across data changes. Construct
points with ChartPoint::new; editing bar_idx reanchors at that index. Screen coordinates
(Pos2) are derived from ChartPoint each frame using the current transforms.
§Example
use egui_charts::drawings::ChartPoint;
let point = ChartPoint::new(100.0, 150.50);
assert_eq!(point.bar_idx, 100.0);
assert_eq!(point.price, 150.50);Fields§
§bar_idx: f32Bar index (can be fractional for points between bars)
price: f64Price level
Implementations§
Source§impl ChartPoint
impl ChartPoint
Sourcepub fn shift_bar_idx(&mut self, delta: f32)
pub fn shift_bar_idx(&mut self, delta: f32)
Shift the bar index by a delta (used when historical data is prepended)
Sourcepub fn with_shifted_bar_idx(self, delta: f32) -> Self
pub fn with_shifted_bar_idx(self, delta: f32) -> Self
Create a new ChartPoint with shifted bar index
Sourcepub fn lerp(a: ChartPoint, b: ChartPoint, t: f32) -> ChartPoint
pub fn lerp(a: ChartPoint, b: ChartPoint, t: f32) -> ChartPoint
Interpolate between two points
Trait Implementations§
Source§impl Clone for ChartPoint
impl Clone for ChartPoint
Source§fn clone(&self) -> ChartPoint
fn clone(&self) -> ChartPoint
Returns a duplicate of the value. Read more
1.0.0 (const: unstable) · Source§fn clone_from(&mut self, source: &Self)
fn clone_from(&mut self, source: &Self)
Performs copy-assignment from
source. Read moreimpl Copy for ChartPoint
Source§impl Debug for ChartPoint
impl Debug for ChartPoint
Source§impl Default for ChartPoint
impl Default for ChartPoint
Auto Trait Implementations§
impl Freeze for ChartPoint
impl RefUnwindSafe for ChartPoint
impl Send for ChartPoint
impl Sync for ChartPoint
impl Unpin for ChartPoint
impl UnsafeUnpin for ChartPoint
impl UnwindSafe for ChartPoint
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
Mutably borrows from an owned value. Read more
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> ⓘ
Converts
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> ⓘ
Converts
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