-
Notifications
You must be signed in to change notification settings - Fork 77
/
radial_polar_bar_label_position.rs
35 lines (34 loc) · 1.1 KB
/
radial_polar_bar_label_position.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
use charming::{
component::{AngleAxis, PolarCoordinate, RadiusAxis, Title},
datatype::CompositeValue,
element::{AxisType, CoordinateSystem, Label, LabelPosition, Tooltip},
series::Bar,
Chart,
};
pub fn chart() -> Chart {
Chart::new()
.title(Title::new().text("Radial Polar Bar Label Position (middle)"))
.polar(
PolarCoordinate::new()
.radius(vec![CompositeValue::from(30), CompositeValue::from("80%")]),
)
.radius_axis(RadiusAxis::new().max(4))
.angle_axis(
AngleAxis::new()
.type_(AxisType::Category)
.data(vec!['a', 'b', 'c', 'd'])
.start_angle(75),
)
.tooltip(Tooltip::new())
.series(
Bar::new()
.coordinate_system(CoordinateSystem::Polar)
.label(
Label::new()
.show(true)
.position(LabelPosition::Middle)
.formatter("{b}: {c}"),
)
.data(vec![2., 1.2, 2.4, 3.6]),
)
}