diff --git a/examples/histogram.rs b/examples/histogram.rs index 420b463..d7a6735 100644 --- a/examples/histogram.rs +++ b/examples/histogram.rs @@ -11,7 +11,7 @@ use std::{ use tui::{ backend::{Backend, CrosstermBackend}, layout::{Constraint, Direction, Layout}, - style::{Color, Modifier, Style}, + style::{Color, Style}, widgets::{Block, Borders, Histogram}, Frame, Terminal, }; @@ -35,7 +35,7 @@ impl App { } fn on_tick(&mut self) { - for i in (0..self.size) { + for i in 0..self.size { self.data[i] = self.rng.gen_range(0..100); } } diff --git a/src/widgets/histogram.rs b/src/widgets/histogram.rs index 78d903b..e4e814f 100644 --- a/src/widgets/histogram.rs +++ b/src/widgets/histogram.rs @@ -5,7 +5,6 @@ use crate::{ symbols, widgets::{Block, Widget}, }; -use std::cmp::min; use unicode_width::UnicodeWidthStr; /// A bar chart specialized for showing histograms @@ -48,10 +47,6 @@ pub struct Histogram<'a> { /// buckets[1] counts items where bucket_size <= x < 2*bucket_size /// etc. buckets: Vec, - /// the size of each bucket - bucket_size: u64, - /// the number of buckets - n_buckets: u64, /// Value necessary for a bar to reach the maximum height (if no value is specified, /// the maximum value in the data is taken as reference) max: Option, @@ -69,8 +64,6 @@ impl<'a> Default for Histogram<'a> { bar_style: Style::default(), bar_gap: 1, bar_set: symbols::bar::NINE_LEVELS, - bucket_size: 0, - n_buckets: 0, buckets: Vec::new(), value_style: Default::default(), label_style: Default::default(),