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§
Sourcefn get_data(&mut self) -> Result<Vec<Point>>
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.
Sourcefn get_num_values(&self) -> Result<usize>
fn get_num_values(&self) -> Result<usize>
The number of values that each Point will have.
Provided Methods§
Sourcefn get_colors(&self) -> Result<Vec<Color>>
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.