plotters icon indicating copy to clipboard operation
plotters copied to clipboard

[Feature Request] Option to display segment count/value above or on Histogram bars

Open baarkerlounger opened this issue 2 years ago • 2 comments

What is the feature ?

Optionally enable value labels for Histogram bars that show the count or value of each segment/bin/category.

(Optional) Why this feature is useful and how people would use the feature ?

On some Histograms with large value ranges it can be hard to read the value of individual bars, particularly if they're far from the axis. Labels would help provide clearer information at a glance.

(Optional) Additional Information

e.g. https://i.stack.imgur.com/WGh7j.png

baarkerlounger avatar Oct 09 '23 20:10 baarkerlounger

Has anybody found out how to render them manually?

mohe2015 avatar Jun 29 '25 10:06 mohe2015

Seems like

chart.draw_series(grades.columns.iter().enumerate().map(|(idx, column)| {
  Text::new(column.1.to_string(), (SegmentValue::CenterOf(idx), column.1), ("sans-serif", 15).into_text_style(&root).pos(Pos::new(HPos::Center, VPos::Top)))
}))?;

kind of works

mohe2015 avatar Jun 29 '25 11:06 mohe2015