The Wayback Machine - https://web.archive.org/web/20201118144625/https://github.com/38/plotters/issues/169
Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

More shorthand functions and ergonomics #169

Open
kangalioo opened this issue Jul 21, 2020 · 3 comments
Open

More shorthand functions and ergonomics #169

kangalioo opened this issue Jul 21, 2020 · 3 comments

Comments

@kangalioo
Copy link

@kangalioo kangalioo commented Jul 21, 2020

What is the feature ?

I'm trying out this library for the first time and I'm seeing several places where some shorthand functions would have been really pleasant:

  1. Shorthand functions for Pos: Pos::top_right, Pos::bottom_right, Pos::bottom_center etc..
  2. Short way to set colors for components. My plots are supposed to be white-on-black, which requires a lot of boilerplate on lots of places
    • a cool start would be to have IntoTextStyle implementation for (FontFamily, T, RGBAColor)
  3. A direct way to create an RGBAColor
  4. A more sensible default font size than one pixel (?? xD) see here
  5. Oh and please derive the common traits for RGBColor, i.e. Copy, Clone, Eq, PartialEq, Default, Hash
  6. From<RGBColor> impl for RGBAColor
  7. Expose BitMapBackendError. I am unable to handle bitmap errors because BitMapBackendError is inaccessible

I might add more things to this list

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

More shorthand functions and ergonomics are always good

@38 38 added this to the 0.3 milestone Aug 26, 2020
@38
Copy link
Owner

@38 38 commented Aug 28, 2020

Thanks for the suggestions and sorry for the delay. I haven't got a chance to look at the issue since a few month ago.

Most of suggestion seems really helpful, but I would like to understand more about few things:

1. Shorthand functions for Pos: `Pos::top_right`, `Pos::bottom_right`, `Pos::bottom_center` etc..

What is this particularly for ? Since we have positioning enums used in both ChartBuilder and legends, which one are you referring or both?

Thanks!

@38
Copy link
Owner

@38 38 commented Aug 29, 2020

Just put the items here for tracking purposes.

  • Short way to set colors for components: e.g. IntoTextStyle implementation for (FontFamily, T, RGBAColor)

  • A direct way to create an RGBAColor

  • Default font size? (This might be a chance to revisit #73 )

  • RGBColor should impl more traits

  • From for RGBAColor

  • BitmapBackendError visibility

@kangalioo
Copy link
Author

@kangalioo kangalioo commented Aug 29, 2020

1. Shorthand functions for Pos: `Pos::top_right`, `Pos::bottom_right`, `Pos::bottom_center` etc..

What is this particularly for ? Since we have positioning enums used in both ChartBuilder and legends, which one are you referring or both?

Looking back at it, I think I had in mind a shorthand for Pos::new(HPos::XXX, VPos::XXX). So,

  • Pos::new(HPos::Center, VPos::Center) => Pos::Center
  • Pos::new(HPos::Top, VPos::Right) => Pos::TopRight

Something like that. On second thought, I'm not sure if this would be worth it.

Also, please excuse my tone in the first message I posted. I was in a bad mood and wanted to show it, sorry

@kangalioo kangalioo changed the title [Feature Request] More ergonomics More shorthand functions and ergonomics Aug 29, 2020
@38 38 added this to Improvments in 0.3 Sep 2, 2020
@38 38 removed this from Frontend Specific in 0.3 Sep 10, 2020
@38 38 removed this from the 0.3 milestone Sep 10, 2020
@38 38 added the good first issue label Sep 10, 2020
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
2 participants
You can’t perform that action at this time.