pub struct Oscilloscope { /* private fields */ }Expand description
Phosphor-style trace over a divided graticule. Samples are -1..=1.
§Example
use ratatui::{buffer::Buffer, layout::Rect, widgets::Widget};
use tui_chart::Oscilloscope;
let scope = Oscilloscope::ecg(3, 240).phase(0.25);
let area = Rect::new(0, 0, 60, 16);
let mut buf = Buffer::empty(area);
scope.render(area, &mut buf);Implementations§
Source§impl Oscilloscope
impl Oscilloscope
Sourcepub fn new(samples: impl IntoIterator<Item = f64>) -> Self
pub fn new(samples: impl IntoIterator<Item = f64>) -> Self
A trace through samples (-1..=1; other values are clamped).
Sourcepub fn wave(partials: &[(f64, f64)], n: usize) -> Self
pub fn wave(partials: &[(f64, f64)], n: usize) -> Self
A sum of sines: (frequency, amplitude) partials over n samples.
Source§impl Oscilloscope
impl Oscilloscope
Trait Implementations§
Source§impl Clone for Oscilloscope
impl Clone for Oscilloscope
Source§impl Debug for Oscilloscope
impl Debug for Oscilloscope
Source§impl Default for Oscilloscope
impl Default for Oscilloscope
Source§impl Widget for &Oscilloscope
impl Widget for &Oscilloscope
Auto Trait Implementations§
impl Freeze for Oscilloscope
impl RefUnwindSafe for Oscilloscope
impl Send for Oscilloscope
impl Sync for Oscilloscope
impl Unpin for Oscilloscope
impl UnsafeUnpin for Oscilloscope
impl UnwindSafe for Oscilloscope
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<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