forked from yuankunzhang/charming
-
Notifications
You must be signed in to change notification settings - Fork 0
/
nightingale.rs
37 lines (36 loc) · 1.17 KB
/
nightingale.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
use charming::{
component::{DataView, Feature, Legend, Restore, SaveAsImage, Toolbox},
element::ItemStyle,
series::{Pie, PieRoseType},
Chart,
};
pub fn chart() -> Chart {
Chart::new()
.legend(Legend::new().top("bottom"))
.toolbox(
Toolbox::new().show(true).feature(
Feature::new()
.data_view(DataView::new().show(true))
.restore(Restore::new().show(true))
.save_as_image(SaveAsImage::new().show(true)),
),
)
.series(
Pie::new()
.name("Nightingale Chart")
.rose_type(PieRoseType::Radius)
.radius(vec!["50", "250"])
.center(vec!["50%", "50%"])
.item_style(ItemStyle::new().border_radius(8))
.data(vec![
(40.0, "rose 1"),
(38.0, "rose 2"),
(32.0, "rose 3"),
(30.0, "rose 4"),
(28.0, "rose 5"),
(26.0, "rose 6"),
(22.0, "rose 7"),
(18.0, "rose 8"),
]),
)
}