-
Notifications
You must be signed in to change notification settings - Fork 77
/
world_population.rs
47 lines (46 loc) · 1.27 KB
/
world_population.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
40
41
42
43
44
45
46
47
use charming::{
component::{Axis, Grid, Legend, Title},
element::{AxisPointer, AxisPointerType, AxisType, Tooltip, Trigger},
series::Bar,
Chart,
};
pub fn chart() -> Chart {
Chart::new()
.title(Title::new().text("World Population"))
.tooltip(
Tooltip::new()
.trigger(Trigger::Axis)
.axis_pointer(AxisPointer::new().type_(AxisPointerType::Shadow)),
)
.legend(Legend::new())
.grid(
Grid::new()
.left("3%")
.right("4%")
.bottom("3%")
.contain_label(true),
)
.x_axis(
Axis::new()
.type_(AxisType::Value)
.boundary_gap(("0", "0.01")),
)
.y_axis(Axis::new().type_(AxisType::Category).data(vec![
"Brazil",
"Indonesia",
"USA",
"India",
"China",
"World",
]))
.series(
Bar::new()
.name("2011")
.data(vec![18203, 23489, 29034, 104970, 131744, 630230]),
)
.series(
Bar::new()
.name("2012")
.data(vec![19325, 23438, 31000, 121594, 134141, 681807]),
)
}