DataSource

Trait DataSource 

Source
pub trait DataSource: Debug + Send {
    // Required methods
    fn get_data(&mut self) -> Result<Vec<Point>>;
    fn get_num_values(&self) -> Result<usize>;

    // Provided method
    fn get_colors(&self) -> Result<Vec<Color>> { ... }
}
Expand description

Implement this to get your own data into a Graph.

Required Methods§

Source

fn get_data(&mut self) -> Result<Vec<Point>>

Return whatever points you have available when this method is called.

Each point must have a t field greater than the previous point.

Each point must have a vs field with length equal to the value returned by get_num_values.

This is currently called once a frame.

Source

fn get_num_values(&self) -> Result<usize>

The number of values that each Point will have.

Provided Methods§

Source

fn get_colors(&self) -> Result<Vec<Color>>

Return the colors you want to use to display each value of the graph.

Some sample colors are returned by default.

If you don’t supply enough colors for the number of values returned, these colors will be repeated.

Implementors§