Better graph descriptions
This commit is contained in:
parent
17a773a5b5
commit
1ed2a9ccc6
@ -226,20 +226,29 @@ pub fn plot_weight_loss(
|
|||||||
// .margin(20)
|
// .margin(20)
|
||||||
.x_label_area_size(30)
|
.x_label_area_size(30)
|
||||||
.y_label_area_size(50)
|
.y_label_area_size(50)
|
||||||
|
.right_y_label_area_size(50)
|
||||||
.build_cartesian_2d(
|
.build_cartesian_2d(
|
||||||
mindate_chrono..maxdate_chrono,
|
mindate_chrono..maxdate_chrono,
|
||||||
(min_weight - 2.)..(max_weight + 2.),
|
(min_weight - 2.)..(max_weight + 2.),
|
||||||
// 70_f32..90_f32,
|
|
||||||
)
|
)
|
||||||
.unwrap();
|
.unwrap()
|
||||||
|
.set_secondary_coord(
|
||||||
|
mindate_chrono..maxdate_chrono,
|
||||||
|
(min_weight - max_weight - 2.)..2.,
|
||||||
|
);
|
||||||
|
|
||||||
chart
|
chart
|
||||||
.configure_mesh()
|
.configure_mesh()
|
||||||
.y_desc("kg fat burned")
|
.y_desc("weight [kg]")
|
||||||
.y_max_light_lines(4)
|
.y_max_light_lines(4)
|
||||||
.x_max_light_lines(6)
|
.x_max_light_lines(6)
|
||||||
.draw()
|
.draw()
|
||||||
.unwrap();
|
.unwrap();
|
||||||
|
chart
|
||||||
|
.configure_secondary_axes()
|
||||||
|
.y_desc("fat burned [kg]")
|
||||||
|
.draw()
|
||||||
|
.unwrap();
|
||||||
|
|
||||||
chart
|
chart
|
||||||
.draw_series(LineSeries::new(
|
.draw_series(LineSeries::new(
|
||||||
@ -268,20 +277,14 @@ pub fn plot_weight_loss(
|
|||||||
RED.stroke_width(3),
|
RED.stroke_width(3),
|
||||||
))
|
))
|
||||||
.unwrap()
|
.unwrap()
|
||||||
.label("kg burned")
|
.label("fat burned")
|
||||||
.legend(|(x, y)| PathElement::new(vec![(x, y), (x + 20, y)], RED));
|
.legend(|(x, y)| PathElement::new(vec![(x, y), (x + 20, y)], RED));
|
||||||
|
|
||||||
chart
|
chart
|
||||||
.draw_series(LineSeries::new(
|
.draw_series(LineSeries::new(
|
||||||
weight.iter().map(|w| {
|
weight
|
||||||
(
|
.iter()
|
||||||
time_date_to_chrono_naive_date(w.datetime.date()),
|
.map(|w| (time_date_to_chrono_naive_date(w.datetime.date()), w.weight)),
|
||||||
// mindate_chrono
|
|
||||||
// .checked_add_days(chrono::Days::new(i.try_into().unwrap()))
|
|
||||||
// .unwrap(),
|
|
||||||
w.weight,
|
|
||||||
)
|
|
||||||
}),
|
|
||||||
BLUE.stroke_width(3),
|
BLUE.stroke_width(3),
|
||||||
))
|
))
|
||||||
.unwrap()
|
.unwrap()
|
||||||
|
Loading…
Reference in New Issue
Block a user