StreamingChart

Trait StreamingChart 

Source
pub trait StreamingChart<C: PixelColor>: Chart<C> {
    type DataPoint: Copy + Clone;

    // Required methods
    fn streaming_animator(&mut self) -> &mut StreamingAnimator<Self::DataPoint>;
    fn draw_streaming<D>(
        &self,
        config: &Self::Config,
        viewport: Rectangle,
        target: &mut D,
        interpolation_progress: Progress,
    ) -> ChartResult<()>
       where D: DrawTarget<Color = C>;
    fn is_smooth_interpolation_enabled(&self) -> bool;

    // Provided methods
    fn push_data(&mut self, point: Self::DataPoint) -> ChartResult<()> { ... }
    fn set_smooth_interpolation(&mut self, enabled: bool) { ... }
}
Expand description

Trait for charts that support real-time data streaming

Required Associated Types§

Source

type DataPoint: Copy + Clone

The type of individual data points

Required Methods§

Source

fn streaming_animator(&mut self) -> &mut StreamingAnimator<Self::DataPoint>

Get the streaming animator for this chart

Source

fn draw_streaming<D>( &self, config: &Self::Config, viewport: Rectangle, target: &mut D, interpolation_progress: Progress, ) -> ChartResult<()>
where D: DrawTarget<Color = C>,

Draw the chart with streaming data and interpolation

§Arguments
  • config - Chart configuration
  • viewport - The area to draw the chart in
  • target - The display target to draw to
  • interpolation_progress - Progress for smooth interpolation (0-100)
Source

fn is_smooth_interpolation_enabled(&self) -> bool

Check if smooth interpolation is enabled

Provided Methods§

Source

fn push_data(&mut self, point: Self::DataPoint) -> ChartResult<()>

Push a new data point to the chart

§Arguments
  • point - The new data point to add
Source

fn set_smooth_interpolation(&mut self, enabled: bool)

Enable or disable smooth interpolation for streaming data

§Arguments
  • enabled - Whether to enable smooth interpolation

Dyn Compatibility§

This trait is not dyn compatible.

In older versions of Rust, dyn compatibility was called "object safety", so this trait is not object safe.

Implementors§