pub struct Sankey { /* private fields */ }Expand description
The Sankey layout generator.
Implementations§
Source§impl Sankey
impl Sankey
Sourcepub fn new() -> Self
pub fn new() -> Self
Create a generator with the d3-sankey defaults (see Sankey::default).
Sourcepub fn node_width(self, node_width: f32) -> Self
pub fn node_width(self, node_width: f32) -> Self
Set the node rectangle width. Defaults to 24.
Sourcepub fn node_padding(self, node_padding: f32) -> Self
pub fn node_padding(self, node_padding: f32) -> Self
Set the vertical gap between nodes in a column. Defaults to 8.
Sourcepub fn node_align(self, align: SankeyAlign) -> Self
pub fn node_align(self, align: SankeyAlign) -> Self
Set the node alignment. Defaults to SankeyAlign::Justify.
Sourcepub fn iterations(self, iterations: usize) -> Self
pub fn iterations(self, iterations: usize) -> Self
Set the number of relaxation passes. Defaults to 6.
Sourcepub fn value_scale(self, value_scale: SankeyValueScale) -> Self
pub fn value_scale(self, value_scale: SankeyValueScale) -> Self
Set how values map to heights. Defaults to SankeyValueScale::Linear.
Sourcepub fn extent(self, x0: f32, y0: f32, x1: f32, y1: f32) -> Self
pub fn extent(self, x0: f32, y0: f32, x1: f32, y1: f32) -> Self
Set the layout bounds as [[x0, y0], [x1, y1]]. Defaults to [[0, 0], [1, 1]].
Sourcepub fn size(self, width: f32, height: f32) -> Self
pub fn size(self, width: f32, height: f32) -> Self
Equivalent to extent(0., 0., width, height).
Sourcepub fn topology(
&self,
node_count: usize,
links: &[SankeyLink],
) -> Result<SankeyGraph, SankeyError>
pub fn topology( &self, node_count: usize, links: &[SankeyLink], ) -> Result<SankeyGraph, SankeyError>
Compute the topology only: node value, depth, height, layer
and horizontal positions, without the vertical placement. Much cheaper
than Sankey::layout when only the column structure is needed
(e.g. to measure labels before fixing the extent).
node_count is the number of nodes; links reference nodes by index
(d3-sankey’s default nodeId). Returns an error if a link references
a node out of range or the graph contains a cycle.
Sourcepub fn layout(
&self,
node_count: usize,
links: &[SankeyLink],
) -> Result<SankeyGraph, SankeyError>
pub fn layout( &self, node_count: usize, links: &[SankeyLink], ) -> Result<SankeyGraph, SankeyError>
Compute the full layout: Sankey::topology plus the vertical node
placement and link breadths.
Sourcepub fn layout_from(&self, graph: SankeyGraph) -> SankeyGraph
pub fn layout_from(&self, graph: SankeyGraph) -> SankeyGraph
Complete the layout for a graph produced by Sankey::topology,
avoiding a second topology pass when the extent only becomes known
after measuring against the column structure (e.g. label margins).
The topological fields are extent-independent; the horizontal and vertical positions are recomputed for this generator’s extent.
Trait Implementations§
Auto Trait Implementations§
impl Freeze for Sankey
impl RefUnwindSafe for Sankey
impl Send for Sankey
impl Sync for Sankey
impl Unpin for Sankey
impl UnsafeUnpin for Sankey
impl UnwindSafe for Sankey
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
Source§impl<T> Instrument for T
impl<T> Instrument for T
Source§fn instrument(self, span: Span) -> Instrumented<Self> ⓘ
fn instrument(self, span: Span) -> Instrumented<Self> ⓘ
Source§fn in_current_span(self) -> Instrumented<Self> ⓘ
fn in_current_span(self) -> Instrumented<Self> ⓘ
Source§impl<T> IntoEither for T
impl<T> IntoEither for T
Source§fn into_either(self, into_left: bool) -> Either<Self, Self> ⓘ
fn into_either(self, into_left: bool) -> Either<Self, Self> ⓘ
self into a Left variant of Either<Self, Self>
if into_left is true.
Converts self into a Right variant of Either<Self, Self>
otherwise. Read moreSource§fn into_either_with<F>(self, into_left: F) -> Either<Self, Self> ⓘ
fn into_either_with<F>(self, into_left: F) -> Either<Self, Self> ⓘ
self into a Left variant of Either<Self, Self>
if into_left(&self) returns true.
Converts self into a Right variant of Either<Self, Self>
otherwise. Read moreSource§impl<T> Pointable for T
impl<T> Pointable for T
Source§impl<R, P> ReadPrimitive<R> for P
impl<R, P> ReadPrimitive<R> for P
Source§fn read_from_little_endian(read: &mut R) -> Result<Self, Error>
fn read_from_little_endian(read: &mut R) -> Result<Self, Error>
ReadEndian::read_from_little_endian().