Components / SankeyChart
SankeyChart
How much flows from what to what: ribbons between nodes, arrow keys, and a clear message when the flows go in a circle.
Example
The component itself, running in WebAssembly, beside its code in a playground. Try it.
Code
use ravenrs::prelude::*;
fn sankey_chart() -> impl View {
SankeyChart::new()
.title("Where the money goes")
.flow("Salary", "Taxes", 1200.0)
.flow("Salary", "Home", 1500.0)
.flow("Salary", "Savings", 800.0)
.flow("Freelance", "Savings", 600.0)
.flow("Home", "Rent", 1100.0)
.flow("Home", "Power", 400.0)
.flow("Savings", "Funds", 900.0)
.flow("Savings", "Stocks", 500.0)
.format(|value| format!("$ {value:.0}"))
.height(300.0)
}