-
-
Notifications
You must be signed in to change notification settings - Fork 462
Open
Labels
Effort: Good First IssueGood for newcomers without much Rust or Ratatui experiance. Apply only if willing to help implementGood for newcomers without much Rust or Ratatui experiance. Apply only if willing to help implementType: EnhancementNew feature or requestNew feature or request
Description
Problem
BarChart's construction is overly verbose. To construct anything other than the default value / text you need to do:
let data = BarGroup::default().bars(&[
Bar::default()
.label("Red".into())
.value(2)
.style(Style::new().red()),
Bar::default()
.label("Green".into())
.value(7)
.style(Style::new().green()),
Bar::default()
.label("Blue".into())
.value(11)
.style(Style::new().blue()),
]);
Solution
- Bar should have a new() method that accepts a label and value
Bar::new("Red", 2)
- Bar::label and the new
new
method should acceptInto<Line>
so we can writeBar::default().label("foo")
- Bar should implement styled so that style shorthands workBar::new("Red", 2").red()
- BarGroup should have a new method that accepts I: IntoIterator, with I::Item = Into so that
Bargroup::new([Bar::new("R", 2").red(), Bar::new("B", 3).blue()])
works - BarGroup::label should accept Into
- BarGroup::bars should accept I:IntoIterator, with I::Item : Into
- BarChart should have a new function that accepts bars (into iterator item = into bar) (unsure if this should also take direction - probably worth doing it as it highlights that direction is available better than just defaulting it)
- Docs and unit tests for all of the above
Generally this should aim to be a non-breaking change. There may be places that are under-tested, so make sure to add any missing unit tests. If you can change a method's behavior and some test doesn't break, then there's probably a missing test.
Metadata
Metadata
Assignees
Labels
Effort: Good First IssueGood for newcomers without much Rust or Ratatui experiance. Apply only if willing to help implementGood for newcomers without much Rust or Ratatui experiance. Apply only if willing to help implementType: EnhancementNew feature or requestNew feature or request