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