pub struct StackLayout { /* private fields */ }Expand description
Computes stacked layout from grouped data.
Equivalent to D3’s d3.stack().
Implementations§
Source§impl StackLayout
impl StackLayout
Sourcepub fn new() -> Self
pub fn new() -> Self
Create a new StackLayout with default settings (StackOrder::None, StackOffset::None).
Sourcepub fn order(self, order: StackOrder) -> Self
pub fn order(self, order: StackOrder) -> Self
Set the stacking order.
Sourcepub fn offset(self, offset: StackOffset) -> Self
pub fn offset(self, offset: StackOffset) -> Self
Set the stacking offset.
Sourcepub fn layout(
&self,
keys: &[String],
series_names: &[String],
values: &[Vec<f64>],
) -> Vec<StackedPoint>
pub fn layout( &self, keys: &[String], series_names: &[String], values: &[Vec<f64>], ) -> Vec<StackedPoint>
Compute stacked layout.
§Arguments
keys: the categories (x-axis values), e.g., [“Jan”, “Feb”, “Mar”]series_names: the series (stacking groups), e.g., [“Hardware”, “Software”, “Services”]values: a 2D structure wherevalues[series_index][key_index]= the value (outer = series, inner = keys)
§Returns
A Vec<StackedPoint> for every (key, series) combination.
Trait Implementations§
Auto Trait Implementations§
impl Freeze for StackLayout
impl RefUnwindSafe for StackLayout
impl Send for StackLayout
impl Sync for StackLayout
impl Unpin for StackLayout
impl UnsafeUnpin for StackLayout
impl UnwindSafe for StackLayout
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