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§
Required Methods§
Sourcefn streaming_animator(&mut self) -> &mut StreamingAnimator<Self::DataPoint>
fn streaming_animator(&mut self) -> &mut StreamingAnimator<Self::DataPoint>
Get the streaming animator for this chart
Sourcefn draw_streaming<D>(
&self,
config: &Self::Config,
viewport: Rectangle,
target: &mut D,
interpolation_progress: Progress,
) -> ChartResult<()>where
D: DrawTarget<Color = C>,
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 configurationviewport- The area to draw the chart intarget- The display target to draw tointerpolation_progress- Progress for smooth interpolation (0-100)
Sourcefn is_smooth_interpolation_enabled(&self) -> bool
fn is_smooth_interpolation_enabled(&self) -> bool
Check if smooth interpolation is enabled
Provided Methods§
Sourcefn push_data(&mut self, point: Self::DataPoint) -> ChartResult<()>
fn push_data(&mut self, point: Self::DataPoint) -> ChartResult<()>
Sourcefn set_smooth_interpolation(&mut self, enabled: bool)
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.