Skip to content

Commit 8677818

Browse files
committed
Add enumerated_label_formatter to demo
1 parent 53c8dd8 commit 8677818

File tree

1 file changed

+4
-4
lines changed

1 file changed

+4
-4
lines changed

demo/src/plot_demo.rs

Lines changed: 4 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -636,14 +636,14 @@ impl CustomAxesDemo {
636636
}
637637
};
638638

639-
let label_fmt = |_s: &str, val: &PlotPoint| {
640-
format!(
639+
let label_fmt = |_nearest: Option<(&str, usize)>, val: &PlotPoint| {
640+
Some(format!(
641641
"Day {d}, {h}:{m:02}\n{p:.2}%",
642642
d = day(val.x),
643643
h = hour(val.x),
644644
m = minute(val.x),
645645
p = percent(val.y)
646-
)
646+
))
647647
};
648648

649649
ui.label("Zoom in on the X-axis to see hours and minutes");
@@ -669,7 +669,7 @@ impl CustomAxesDemo {
669669
.custom_x_axes(x_axes)
670670
.custom_y_axes(y_axes)
671671
.x_grid_spacer(Self::x_grid)
672-
.label_formatter(label_fmt)
672+
.enumerated_label_formatter(label_fmt)
673673
.show(ui, |plot_ui| {
674674
plot_ui.line(Self::logistic_fn());
675675
})

0 commit comments

Comments
 (0)