forked from yuankunzhang/charming
-
Notifications
You must be signed in to change notification settings - Fork 0
/
sankey_orient_vertical.rs
34 lines (33 loc) · 1.02 KB
/
sankey_orient_vertical.rs
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
use charming::{
element::{
Emphasis, EmphasisFocus, Label, LabelPosition, LineStyle, Orient, Tooltip, Trigger,
TriggerOn,
},
series::Sankey,
Chart,
};
pub fn chart() -> Chart {
Chart::new()
.tooltip(
Tooltip::new()
.trigger(Trigger::Item)
.trigger_on(TriggerOn::Mousemove),
)
.series(
Sankey::new()
.bottom("10%")
.emphasis(Emphasis::new().focus(EmphasisFocus::Adjacency))
.orient(Orient::Vertical)
.label(Label::new().position(LabelPosition::Top))
.line_style(LineStyle::new().color("source").curveness(0.5))
.data(vec!["a", "b", "a1", "b1", "c", "e"])
.links(vec![
("a", "a1", 5),
("e", "b", 3),
("a", "b1", 3),
("b1", "a1", 1),
("b1", "c", 2),
("b", "c", 1),
]),
)
}