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]

Trait Implementations

impl<'a> Default for Chart<'a>
[src]

Returns the "default value" for a type. Read more

impl<'a> Widget for Chart<'a>
[src]

Draws the current state of the widget in the given buffer. That the only method required to implement a custom widget. Read more

Helper method to quickly set the background of all cells inside the specified area.

Helper method that can be chained with a widget's builder methods to render it.