forked from yuankunzhang/charming
-
Notifications
You must be signed in to change notification settings - Fork 0
/
referer_of_a_website.rs
39 lines (38 loc) · 1.14 KB
/
referer_of_a_website.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
35
36
37
38
39
use charming::{
component::{Legend, Title},
df,
element::{Emphasis, ItemStyle, Orient, Tooltip, Trigger},
series::Pie,
Chart,
};
pub fn chart() -> Chart {
Chart::new()
.title(
Title::new()
.text("Referer of a Website")
.subtext("Fake Data")
.left("center"),
)
.tooltip(Tooltip::new().trigger(Trigger::Item))
.legend(Legend::new().orient(Orient::Vertical).left("left"))
.series(
Pie::new()
.name("Access From")
.radius("50%")
.data(df!(
(1048, "Search Engine"),
(735, "Direct"),
(580, "Email"),
(484, "Union Ads"),
(300, "Video Ads")
))
.emphasis(
Emphasis::new().item_style(
ItemStyle::new()
.shadow_blur(10)
.shadow_offset_x(0)
.shadow_color("rgba(0, 0, 0, 0.5)"),
),
),
)
}