pub struct PointLayer { /* private fields */ }Expand description
A strict supplemental point layer owned independently from the primary line.
The aligned x/y values are arbitrary caller-selected coordinates. Optional labels annotate individual points, while an optional legend label identifies the complete layer once.
use lichtung_plot::{Color, NumericValues, Text, Theme, elements::PointLayer, text::TextAlignment};
let label = Text::new("Selected coordinates").style(
Theme::publication().typography().get_guides().get_legend_label().clone()
).alignment(TextAlignment::End);
let layer = PointLayer::new(
NumericValues::new("x", [1.0]), NumericValues::new("y", [2.0]),
).alpha(0.5)?.color(Color::rgb(20, 80, 140)).radius(5)?.legend_label(label);
assert_eq!(layer.get_alpha(), Some(0.5));
assert_eq!(layer.get_color(), Some(Color::rgb(20, 80, 140)));There is one explicit alpha setter; no second opacity alias:
use lichtung_plot::{NumericValues, elements::PointLayer};
let _ = PointLayer::new(
NumericValues::new("x", [1.0]), NumericValues::new("y", [2.0]),
).opacity(0.5);Implementations§
Source§impl PointLayer
impl PointLayer
Sourcepub fn label_text_layout(self, layout: TextLayout) -> PointLayer
pub fn label_text_layout(self, layout: TextLayout) -> PointLayer
Replace the complete layout default for this layer’s column-backed labels.
Sourcepub fn new(x: NumericValues, y: NumericValues) -> PointLayer
pub fn new(x: NumericValues, y: NumericValues) -> PointLayer
Construct an owned point layer with owner-theme styling.
The x/y values may describe raw observations or any other supplemental coordinates and need not align with the primary line input. They default to the next theme-coordinated color and the theme’s supplemental radius and alpha (built-ins use radius 4 and alpha 0.8). Nonempty, aligned, finite values are validated during chart preflight.
Sourcepub fn color(self, color: Color) -> PointLayer
pub fn color(self, color: Color) -> PointLayer
Replace the automatic mark paint and label paint with complete RGBA. An independent explicit alpha instruction takes precedence over this alpha.
Sourcepub fn alpha(self, alpha: f64) -> Result<PointLayer, Error>
pub fn alpha(self, alpha: f64) -> Result<PointLayer, Error>
Replace mark and label alpha, including transparent and opaque endpoints.
This replaces alpha after resolving color, regardless of edit order. Without an exact color, label RGB stays owned by its theme text role.
Sourcepub const fn get_color(&self) -> Option<Color>
pub const fn get_color(&self) -> Option<Color>
Inspect the optional caller paint instruction, before theme resolution.
Sourcepub const fn get_alpha(&self) -> Option<f64>
pub const fn get_alpha(&self) -> Option<f64>
Inspect the optional caller alpha instruction, before theme resolution.
Sourcepub const fn get_radius(&self) -> Option<u32>
pub const fn get_radius(&self) -> Option<u32>
Inspect the optional caller radius instruction, before theme resolution.
Sourcepub fn labels(self, labels: CategoryValues) -> PointLayer
pub fn labels(self, labels: CategoryValues) -> PointLayer
Attach one caller-owned annotation label to every point.
Point labels do not create legend entries. They must align one-to-one with the layer’s x/y coordinates.
Sourcepub fn legend_label(self, label: impl Into<Text>) -> PointLayer
pub fn legend_label(self, label: impl Into<Text>) -> PointLayer
Give the complete layer one legend identity.
This creates at most one legend entry and does not label individual points. Identity uses the retained source; style and layout remain display instructions. Plain replacement retains prior Text instructions. Duplicate identities require equal complete displayed Text and mark keys.
Sourcepub fn clear_legend_label_style(self) -> PointLayer
pub fn clear_legend_label_style(self) -> PointLayer
Remove only the local legend-label appearance, retaining its identity/layout.
Sourcepub fn clear_legend_label_layout(self) -> PointLayer
pub fn clear_legend_label_layout(self) -> PointLayer
Remove only the local legend-label layout, retaining its identity/appearance.
Trait Implementations§
Source§impl Clone for PointLayer
impl Clone for PointLayer
Source§fn clone(&self) -> PointLayer
fn clone(&self) -> PointLayer
1.0.0 (const: unstable) · Source§fn clone_from(&mut self, source: &Self)
fn clone_from(&mut self, source: &Self)
source. Read moreSource§impl Debug for PointLayer
impl Debug for PointLayer
Source§impl From<PointLayerAdapter<'_>> for PointLayer
impl From<PointLayerAdapter<'_>> for PointLayer
Source§fn from(adapter: PointLayerAdapter<'_>) -> Self
fn from(adapter: PointLayerAdapter<'_>) -> Self
Auto Trait Implementations§
impl Forget for PointLayer
impl Freeze for PointLayerwhere
*const ArcInner<()> is !null: Freeze,
PhantomData<ArcInner<()>>: Freeze,
*const ArcInner<TextInstructions> is !null: Freeze,
PhantomData<ArcInner<TextInstructions>>: Freeze,
*const ArcInner<str> is !null: Freeze,
PhantomData<ArcInner<str>>: Freeze,
*const ArcInner<[f64]> is !null: Freeze,
PhantomData<ArcInner<[f64]>>: Freeze,
*const ArcInner<[u64]> is !null: Freeze,
PhantomData<ArcInner<[u64]>>: Freeze,
*const ArcInner<(RawKey, Arc<str>)> is !null: Freeze,
PhantomData<ArcInner<(RawKey, Arc<str>)>>: Freeze,
*const ArcInner<SourceInfo> is !null: Freeze,
PhantomData<ArcInner<SourceInfo>>: Freeze,
*const ArcInner<SourceProjection> is !null: Freeze,
PhantomData<ArcInner<SourceProjection>>: Freeze,
*const ArcInner<[String]> is !null: Freeze,
PhantomData<ArcInner<[String]>>: Freeze,
*const ArcInner<[u32]> is !null: Freeze,
PhantomData<ArcInner<[u32]>>: Freeze,
*const ArcInner<KeyValues> is !null: Freeze,
PhantomData<ArcInner<KeyValues>>: Freeze,
*const ArcInner<String> is !null: Freeze,
PhantomData<ArcInner<String>>: Freeze,
*const ArcInner<Vec<FontFamily>> is !null: Freeze,
PhantomData<ArcInner<Vec<FontFamily>>>: Freeze,
impl Move for PointLayer
impl RefUnwindSafe for PointLayer
impl Send for PointLayer
impl Sync for PointLayer
impl Unpin for PointLayerwhere
Arc<()>: Unpin,
Arc<TextInstructions>: Unpin,
Arc<str>: Unpin,
Arc<[f64]>: Unpin,
Arc<[u64]>: Unpin,
Arc<(RawKey, Arc<str>)>: Unpin,
Arc<SourceInfo>: Unpin,
Arc<SourceProjection>: Unpin,
Arc<[String]>: Unpin,
Arc<[u32]>: Unpin,
Arc<KeyValues>: Unpin,
Arc<String>: Unpin,
Arc<Vec<FontFamily>>: Unpin,
impl UnsafeUnpin for PointLayerwhere
*const ArcInner<()> is !null: UnsafeUnpin,
PhantomData<ArcInner<()>>: UnsafeUnpin,
*const ArcInner<TextInstructions> is !null: UnsafeUnpin,
PhantomData<ArcInner<TextInstructions>>: UnsafeUnpin,
*const ArcInner<str> is !null: UnsafeUnpin,
PhantomData<ArcInner<str>>: UnsafeUnpin,
*const ArcInner<[f64]> is !null: UnsafeUnpin,
PhantomData<ArcInner<[f64]>>: UnsafeUnpin,
*const ArcInner<[u64]> is !null: UnsafeUnpin,
PhantomData<ArcInner<[u64]>>: UnsafeUnpin,
*const ArcInner<(RawKey, Arc<str>)> is !null: UnsafeUnpin,
PhantomData<ArcInner<(RawKey, Arc<str>)>>: UnsafeUnpin,
*const ArcInner<SourceInfo> is !null: UnsafeUnpin,
PhantomData<ArcInner<SourceInfo>>: UnsafeUnpin,
*const ArcInner<SourceProjection> is !null: UnsafeUnpin,
PhantomData<ArcInner<SourceProjection>>: UnsafeUnpin,
*const ArcInner<[String]> is !null: UnsafeUnpin,
PhantomData<ArcInner<[String]>>: UnsafeUnpin,
*const ArcInner<[u32]> is !null: UnsafeUnpin,
PhantomData<ArcInner<[u32]>>: UnsafeUnpin,
*const ArcInner<KeyValues> is !null: UnsafeUnpin,
PhantomData<ArcInner<KeyValues>>: UnsafeUnpin,
*const ArcInner<String> is !null: UnsafeUnpin,
PhantomData<ArcInner<String>>: UnsafeUnpin,
*const ArcInner<Vec<FontFamily>> is !null: UnsafeUnpin,
PhantomData<ArcInner<Vec<FontFamily>>>: UnsafeUnpin,
impl UnwindSafe for PointLayerwhere
Arc<()>: UnwindSafe,
Arc<TextInstructions>: UnwindSafe,
Arc<str>: UnwindSafe,
Arc<[f64]>: UnwindSafe,
Arc<[u64]>: UnwindSafe,
Arc<(RawKey, Arc<str>)>: UnwindSafe,
Arc<SourceInfo>: UnwindSafe,
Arc<SourceProjection>: UnwindSafe,
Arc<[String]>: UnwindSafe,
Arc<[u32]>: UnwindSafe,
Arc<KeyValues>: UnwindSafe,
Arc<String>: UnwindSafe,
Arc<Vec<FontFamily>>: 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
impl<ST, DT> CastableFrom<ST, Initialized, Initialized> for DT
impl<ST, DT> CastableFrom<ST, Uninit, Uninit> for DT
Source§impl<T> CloneToUninit for Twhere
T: Clone,
impl<T> CloneToUninit for Twhere
T: Clone,
impl<T> Read<Exclusive, BecauseExclusive> for Twhere
T: ?Sized,
Source§impl<SS, SP> SupersetOf<SS> for SPwhere
SS: SubsetOf<SP>,
impl<SS, SP> SupersetOf<SS> for SPwhere
SS: SubsetOf<SP>,
Source§fn to_subset(&self) -> Option<SS>
fn to_subset(&self) -> Option<SS>
self from the equivalent element of its
superset. Read moreSource§fn is_in_subset(&self) -> bool
fn is_in_subset(&self) -> bool
self is actually part of its subset T (and can be converted to it).Source§fn to_subset_unchecked(&self) -> SS
fn to_subset_unchecked(&self) -> SS
self.to_subset but without any property checks. Always succeeds.Source§fn from_subset(element: &SS) -> SP
fn from_subset(element: &SS) -> SP
self to the equivalent element of its superset.