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 new() -> SankeyChart
pub fn new() -> SankeyChart
An empty diagram, 300 logical pixels tall, as wide as its parent allows.
Sourcepub fn flow(
self,
source: impl Into<String>,
target: impl Into<String>,
value: f64,
) -> SankeyChart
pub fn flow( self, source: impl Into<String>, target: impl Into<String>, value: f64, ) -> SankeyChart
So much flows from source to target. Nothing, or less, draws nothing.
Sourcepub fn title(self, title: impl Into<String>) -> SankeyChart
pub fn title(self, title: impl Into<String>) -> SankeyChart
A title above the diagram.
Sourcepub fn alt(self, text: impl Into<String>) -> SankeyChart
pub fn alt(self, text: impl Into<String>) -> SankeyChart
Describes the diagram for screen readers, in place of its title. Its flows are read after it.
Sourcepub fn height(self, height: f32) -> SankeyChart
pub fn height(self, height: f32) -> SankeyChart
Height in logical pixels (default 300).
Sourcepub fn size(self, width: f32, height: f32) -> SankeyChart
pub fn size(self, width: f32, height: f32) -> SankeyChart
Fixed size in logical pixels.
Sourcepub fn align(self, align: SankeyAlign) -> SankeyChart
pub fn align(self, align: SankeyAlign) -> SankeyChart
Which column a node goes to, among those its flows allow.
Sourcepub fn format(self, format: impl Fn(f64) -> String + 'static) -> SankeyChart
pub fn format(self, format: impl Fn(f64) -> String + 'static) -> SankeyChart
How numbers are written (at most two decimals by default).
Sourcepub fn node_color(self, name: impl Into<String>, color: Semantic) -> SankeyChart
pub fn node_color(self, name: impl Into<String>, color: Semantic) -> SankeyChart
Gives this node a color of the theme, in place of the next chart color.
Sourcepub fn no_gradient(self) -> SankeyChart
pub fn no_gradient(self) -> SankeyChart
Ribbons in the color of their source, instead of going to that of their target.
Sourcepub fn hide_tooltip(self) -> SankeyChart
pub fn hide_tooltip(self) -> SankeyChart
Says nothing under the pointer and takes no keyboard focus.
Sourcepub fn no_appear(self) -> SankeyChart
pub fn no_appear(self) -> SankeyChart
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) -> SankeyChart
pub fn appear_key(self, key: impl Hash) -> SankeyChart
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
Source§fn default() -> SankeyChart
fn default() -> 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§
impl<T> AutoreleaseSafe for Twhere
T: ?Sized,
impl<T> AutoreleaseSafe for Twhere
T: ?Sized,
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<S, T> Duplex<S> for Twhere
T: FromSample<S> + ToSample<S>,
impl<T> ErasedDestructor for Twhere
T: 'static,
§impl<S> FromSample<S> for S
impl<S> FromSample<S> for S
fn from_sample_(s: S) -> S
§impl<T> Instrument for T
impl<T> Instrument for T
§fn instrument(self, span: Span) -> Instrumented<Self> ⓘ
fn instrument(self, span: Span) -> Instrumented<Self> ⓘ
impl<T> Read<Exclusive, BecauseExclusive> for Twhere
T: ?Sized,
§impl<T, U> ToSample<U> for Twhere
U: FromSample<T>,
impl<T, U> ToSample<U> for Twhere
U: FromSample<T>,
fn to_sample_(self) -> U
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.