pub struct Interaction { /* private fields */ }Expand description
Pointer state: hover position, selection and hidden series.
Implementations§
Source§impl Interaction
impl Interaction
Sourcepub fn on_click(&mut self, x: u16, y: u16, hits: &HitMap) -> Click
pub fn on_click(&mut self, x: u16, y: u16, hits: &HitMap) -> Click
Primary click at (x, y): toggles a legend entry, or selects / clears.
Sourcepub fn toggle(&mut self, series: usize) -> bool
pub fn toggle(&mut self, series: usize) -> bool
Toggle visibility of series; returns true when it is now hidden.
Hidden series indices, for charts’ .hidden(..).
Whether series is hidden.
Sourcepub fn selected(&self) -> Option<(usize, usize)>
pub fn selected(&self) -> Option<(usize, usize)>
The pinned (clicked) element, (series, index).
Sourcepub fn tooltip_style(self, style: Style) -> Self
pub fn tooltip_style(self, style: Style) -> Self
Tooltip style (default: white on dark gray).
Sourcepub fn hovered<'a>(&self, hits: &'a HitMap) -> Option<&'a Hit>
pub fn hovered<'a>(&self, hits: &'a HitMap) -> Option<&'a Hit>
The element currently under the pointer.
Sourcepub fn render_tooltip(&self, hits: &HitMap, buf: &mut Buffer, bounds: Rect)
pub fn render_tooltip(&self, hits: &HitMap, buf: &mut Buffer, bounds: Rect)
Highlight the hovered / selected element and draw its tooltip, clamped
to bounds. Call after rendering the chart.
Trait Implementations§
Source§impl Clone for Interaction
impl Clone for Interaction
Source§impl Debug for Interaction
impl Debug for Interaction
Source§impl Default for Interaction
impl Default for Interaction
impl Eq for Interaction
Source§impl PartialEq for Interaction
impl PartialEq for Interaction
impl StructuralPartialEq for Interaction
Auto Trait Implementations§
impl Forget for Interaction
impl Freeze for Interaction
impl Move for Interaction
impl RefUnwindSafe for Interaction
impl Send for Interaction
impl Sync for Interaction
impl Unpin for Interaction
impl UnsafeUnpin for Interaction
impl UnwindSafe for Interaction
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
Source§impl<T> CloneToUninit for Twhere
T: Clone,
impl<T> CloneToUninit for Twhere
T: Clone,
Source§impl<Q, K> Equivalent<K> for Q
impl<Q, K> Equivalent<K> for Q
Source§fn equivalent(&self, key: &K) -> bool
fn equivalent(&self, key: &K) -> bool
Compare self to
key and return true if they are equal.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