pub struct LineArtist {
pub x: Series,
pub y: Series,
pub color: Color,
pub width: f64,
pub style: LineStyle,
pub label: Option<String>,
pub alpha: f64,
pub decimate: Option<(usize, DecimateMethod)>,
}Expand description
A line chart connecting a sequence of (x, y) data points.
The x and y series must have the same length. Points are drawn in
order, producing a single connected polyline with the configured stroke
style.
Fields§
§x: SeriesX-coordinates of the data points.
y: SeriesY-coordinates of the data points.
color: ColorStroke color of the line.
width: f64Stroke width in pixels.
style: LineStyleStroke pattern (solid, dashed, dotted, dash-dot).
label: Option<String>Optional legend label. When Some, the line appears in the legend.
alpha: f64Opacity from 0.0 (fully transparent) to 1.0 (fully opaque).
decimate: Option<(usize, DecimateMethod)>Optional decimation: (threshold, method). When set and data length
exceeds threshold, the rendering pipeline downsamples the data
before drawing.
Implementations§
Source§impl LineArtist
impl LineArtist
Source§impl LineArtist
impl LineArtist
Sourcepub fn style(&mut self, style: LineStyle) -> &mut Self
pub fn style(&mut self, style: LineStyle) -> &mut Self
Sets the line style (solid, dashed, dotted, dash-dot).
The LineStyle enum defines the available stroke patterns. The default
is LineStyle::Solid.
§Examples
artist.style(LineStyle::Dashed);Sourcepub fn decimate(&mut self, threshold: usize) -> &mut Self
pub fn decimate(&mut self, threshold: usize) -> &mut Self
Enables LTTB decimation with the given point threshold.
When the data series length exceeds threshold, the rendering
pipeline downsamples the data using the Largest Triangle Three
Buckets algorithm before drawing. This dramatically improves
rendering performance for large datasets (100k+ points) with
negligible visual impact.
§Examples
ax.plot(&x, &y)?.decimate(1000);Sourcepub fn decimate_with(
&mut self,
threshold: usize,
method: DecimateMethod,
) -> &mut Self
pub fn decimate_with( &mut self, threshold: usize, method: DecimateMethod, ) -> &mut Self
Enables decimation with a specific method and point threshold.
Available methods:
DecimateMethod::Lttb— best visual fidelity (default)DecimateMethod::MinMax— fastest, preserves peaks/troughs
§Examples
ax.plot(&x, &y)?.decimate_with(1000, DecimateMethod::MinMax);Trait Implementations§
Source§impl Clone for LineArtist
impl Clone for LineArtist
Source§fn clone(&self) -> LineArtist
fn clone(&self) -> LineArtist
1.0.0 (const: unstable) · Source§fn clone_from(&mut self, source: &Self)
fn clone_from(&mut self, source: &Self)
source. Read more