Skip to main content

bar_chart

Function bar_chart 

Source
pub fn bar_chart(value: f64, max: f64, width: usize) -> String
Expand description

Render a horizontal bar chart using Unicode block characters.

value and max define the proportion. width is the bar length in chars. Returns filled (โ–ˆ) and empty (โ–‘) segments. Pure text โ€” callers apply color via owo_colors for consistency.

ยงExamples

let bar = bar_chart(50.0, 100.0, 10);
assert_eq!(bar.chars().count(), 10);