Struct tui::widgets::Chart
[−]
[src]
pub struct Chart<'a> { /* fields omitted */ }
A widget to plot one or more dataset in a cartesian coordinate system
Examples
Chart::default() .block(Block::default().title("Chart")) .x_axis(Axis::default() .title("X Axis") .title_style(Style::default().fg(Color::Red)) .style(Style::default().fg(Color::Gray)) .bounds([0.0, 10.0]) .labels(&["0.0", "5.0", "10.0"])) .y_axis(Axis::default() .title("Y Axis") .title_style(Style::default().fg(Color::Red)) .style(Style::default().fg(Color::Gray)) .bounds([0.0, 10.0]) .labels(&["0.0", "5.0", "10.0"])) .datasets(&[Dataset::default() .name("data1") .marker(Marker::Dot) .style(Style::default().fg(Color::Cyan)) .data(&[(0.0, 5.0), (1.0, 6.0), (1.5, 6.434)]), Dataset::default() .name("data2") .marker(Marker::Braille) .style(Style::default().fg(Color::Magenta)) .data(&[(4.0, 5.0), (5.0, 8.0), (7.66, 13.5)])]);
Methods
impl<'a> Chart<'a>
[src]
fn block(&'a mut self, block: Block<'a>) -> &mut Chart<'a>
fn style(&mut self, style: Style) -> &mut Chart<'a>
fn x_axis(&mut self, axis: Axis<'a>) -> &mut Chart<'a>
fn y_axis(&mut self, axis: Axis<'a>) -> &mut Chart<'a>
fn datasets(&mut self, datasets: &'a [Dataset<'a>]) -> &mut Chart<'a>
Trait Implementations
impl<'a> Default for Chart<'a>
[src]
impl<'a> Widget for Chart<'a>
[src]
fn draw(&self, area: &Rect, buf: &mut Buffer)
Draws the current state of the widget in the given buffer. That the only method required to implement a custom widget. Read more
fn background(&self, area: &Rect, buf: &mut Buffer, color: Color)
Helper method to quickly set the background of all cells inside the specified area.
fn render<B>(&self, t: &mut Terminal<B>, area: &Rect) where
Self: Sized,
B: Backend,
Self: Sized,
B: Backend,
Helper method that can be chained with a widget's builder methods to render it.