You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
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 accept Into<Line> so we can write Bar::default().label("foo") - Bar should implement styled so that style shorthands work Bar::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.
The text was updated successfully, but these errors were encountered:
Problem
BarChart's construction is overly verbose. To construct anything other than the default value / text you need to do:
Solution
Bar::new("Red", 2)
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::new([Bar::new("R", 2").red(), Bar::new("B", 3).blue()])
worksGenerally 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.
The text was updated successfully, but these errors were encountered: