pub struct SankeyChart { /* private fields */ }Expand description
How much flows from what to what. Each flow names its two ends, and
nodes are created as they are named. Ribbons go from the color of their source to
that of their target; under the pointer or with the arrow keys, what is connected
stands out and the tooltip says how much. A screen reader hears every flow.
If the flows go in a circle there is no way to draw them, and it says which nodes
the circle goes through, in place of the diagram. Available with the charts
feature, on by default.
use ravenrs_widgets::SankeyChart;
let budget = SankeyChart::new()
.title("Budget")
.flow("Salary", "Rent", 1200.0)
.flow("Salary", "Food", 600.0)
.flow("Salary", "Savings", 400.0)
.flow("Savings", "Funds", 400.0);Implementations§
Source§impl SankeyChart
impl SankeyChart
Sourcepub fn flow(
self,
source: impl Into<String>,
target: impl Into<String>,
value: f64,
) -> Self
pub fn flow( self, source: impl Into<String>, target: impl Into<String>, value: f64, ) -> Self
So much flows from source to target. Nothing, or less, draws nothing.
Sourcepub fn alt(self, text: impl Into<String>) -> Self
pub fn alt(self, text: impl Into<String>) -> Self
Describes the diagram for screen readers, in place of its title. Its flows are read after it.
Sourcepub fn align(self, align: SankeyAlign) -> Self
pub fn align(self, align: SankeyAlign) -> Self
Which column a node goes to, among those its flows allow.
Sourcepub fn format(self, format: impl Fn(f64) -> String + 'static) -> Self
pub fn format(self, format: impl Fn(f64) -> String + 'static) -> Self
How numbers are written (at most two decimals by default).
Sourcepub fn node_color(self, name: impl Into<String>, color: Semantic) -> Self
pub fn node_color(self, name: impl Into<String>, color: Semantic) -> Self
Gives this node a color of the theme, in place of the next chart color.
Sourcepub fn no_gradient(self) -> Self
pub fn no_gradient(self) -> Self
Ribbons in the color of their source, instead of going to that of their target.
Sourcepub fn hide_tooltip(self) -> Self
pub fn hide_tooltip(self) -> Self
Says nothing under the pointer and takes no keyboard focus.
Sourcepub fn no_appear(self) -> Self
pub fn no_appear(self) -> Self
The flows are whole from the first frame, instead of drawing in from the left the first time the chart is painted.
Sourcepub fn appear_key(self, key: impl Hash) -> Self
pub fn appear_key(self, key: impl Hash) -> Self
Draws the flows in again whenever key changes.
Trait Implementations§
Source§impl Clone for SankeyChart
impl Clone for SankeyChart
Source§fn clone(&self) -> SankeyChart
fn clone(&self) -> SankeyChart
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 SankeyChart
impl Debug for SankeyChart
Source§impl Default for SankeyChart
impl Default for SankeyChart
Auto Trait Implementations§
impl !RefUnwindSafe for SankeyChart
impl !Send for SankeyChart
impl !Sync for SankeyChart
impl !UnwindSafe for SankeyChart
impl Freeze for SankeyChart
impl Unpin for SankeyChart
impl UnsafeUnpin for SankeyChart
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> CloneToUninit for Twhere
T: Clone,
impl<T> CloneToUninit for Twhere
T: Clone,
impl<T> ErasedDestructor for Twhere
T: 'static,
§impl<T> Instrument for T
impl<T> Instrument for T
§fn instrument(self, span: Span) -> Instrumented<Self> ⓘ
fn instrument(self, span: Span) -> Instrumented<Self> ⓘ
Source§impl<V> ViewExt for Vwhere
V: View,
impl<V> ViewExt for Vwhere
V: View,
Source§fn padding(self, padding: impl Into<Insets>) -> Styled<Self>
fn padding(self, padding: impl Into<Insets>) -> Styled<Self>
Source§fn background(self, fill: impl Into<Fill>) -> Styled<Self>
fn background(self, fill: impl Into<Fill>) -> Styled<Self>
Source§fn frame(self, width: Option<f32>, height: Option<f32>) -> Styled<Self>
fn frame(self, width: Option<f32>, height: Option<f32>) -> Styled<Self>
None keeps the content size.