pub struct PlotSpec {Show 14 fields
pub version: u32,
pub title: Option<String>,
pub x_label: Option<String>,
pub y_label: Option<String>,
pub width: u32,
pub height: u32,
pub x_scale: Scale,
pub y_scale: Scale,
pub x_range: Option<[f64; 2]>,
pub y_range: Option<[f64; 2]>,
pub series: Vec<SeriesSpec>,
pub legend: bool,
pub grid: bool,
pub theme: Option<PlotTheme>,
}Expand description
A complete chart as data.
use crisol_plot_core::spec::{PlotSpec, SeriesKind, SeriesSpec};
let spec = PlotSpec::new(640, 360)
.title("Signal")
.series(SeriesSpec::line("v", vec![[0.0, 1.0], [1.0, 2.0]]));
assert_eq!(spec.series[0].kind, SeriesKind::Line);Fields§
§version: u32The schema version; PLOT_SPEC_VERSION for new charts.
title: Option<String>Chart title.
x_label: Option<String>Horizontal axis title.
y_label: Option<String>Left vertical axis title.
width: u32Image width in pixels.
height: u32Image height in pixels.
x_scale: ScaleHorizontal scale.
y_scale: ScaleLeft vertical scale.
x_range: Option<[f64; 2]>Fixed x range in data units; automatic when None.
y_range: Option<[f64; 2]>Fixed y range in data units; automatic when None.
series: Vec<SeriesSpec>The series, drawn in order.
legend: boolDraw the legend.
grid: boolDraw major grid lines.
theme: Option<PlotTheme>Canvas and text colors; the renderer defaults when None.
Implementations§
Source§impl PlotSpec
impl PlotSpec
Sourcepub fn series(self, series: SeriesSpec) -> Self
pub fn series(self, series: SeriesSpec) -> Self
Append a series.
Sourcepub fn preset(self, preset: PagePreset, dpi: u32) -> Self
pub fn preset(self, preset: PagePreset, dpi: u32) -> Self
Set the size from a publication preset at dpi.
Trait Implementations§
Source§impl<'de> Deserialize<'de> for PlotSpec
impl<'de> Deserialize<'de> for PlotSpec
Source§fn deserialize<__D>(__deserializer: __D) -> Result<Self, __D::Error>where
__D: Deserializer<'de>,
fn deserialize<__D>(__deserializer: __D) -> Result<Self, __D::Error>where
__D: Deserializer<'de>,
Deserialize this value from the given Serde deserializer. Read more
impl StructuralPartialEq for PlotSpec
Auto Trait Implementations§
impl Forget for PlotSpec
impl Freeze for PlotSpecwhere
*const u8 is !null: Freeze,
PhantomData<u8>: Freeze,
PhantomData<SeriesSpec>: Freeze,
PhantomData<Rgba>: Freeze,
impl Move for PlotSpec
impl RefUnwindSafe for PlotSpec
impl Send for PlotSpecwhere
RawVecInner: Send,
impl Sync for PlotSpecwhere
RawVecInner: Sync,
impl Unpin for PlotSpec
impl UnsafeUnpin for PlotSpecwhere
*const u8 is !null: UnsafeUnpin,
PhantomData<u8>: UnsafeUnpin,
PhantomData<SeriesSpec>: UnsafeUnpin,
PhantomData<Rgba>: UnsafeUnpin,
impl UnwindSafe for PlotSpecwhere
RawVecInner: UnwindSafe,
Blanket Implementations§
Source§impl<T> BorrowMut<T> for Twhere
T: ?Sized,
impl<T> BorrowMut<T> for Twhere
T: ?Sized,
Source§fn borrow_mut(&mut self) -> &mut T
fn borrow_mut(&mut self) -> &mut T
Mutably borrows from an owned value. Read more