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

Closed
kangalio opened this issue Jul 21, 2020 · 6 comments
Closed

More shorthand functions and ergonomics #169

kangalio opened this issue Jul 21, 2020 · 6 comments
Labels

Comments

@kangalio
Copy link

kangalio commented Jul 21, 2020

What is the feature ?

I'm trying out this library for the first time and there's some places where it would be delightful to have shorthand functions:

  1. Shorthand functions for Pos: Pos::top_right, Pos::bottom_right, Pos::bottom_center etc..
  2. Short way to set colors for components. Currently, lots of boilerplate is required for e.g. white-on-black plotos
    • 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 see here
  5. Common trait derives for RGBColor, i.e. Copy, Clone, Eq, PartialEq, Default, Hash
  6. From<RGBColor> impl for RGBAColor
  7. Expose BitMapBackendError to allow handling those errors

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

More shorthand functions and ergonomics are always good, I think

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

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
Member

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 [Feature Request] Global default settings #73 )

  • RGBColor should impl more traits

  • From for RGBAColor

  • BitmapBackendError visibility

@kangalio
Copy link
Author

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

@kangalio kangalio changed the title [Feature Request] More ergonomics More shorthand functions and ergonomics Aug 29, 2020
@38 38 removed this from the 0.3 milestone Sep 10, 2020
@38 38 added the good first issue Good for newcomers label Sep 10, 2020
@slackinghyena
Copy link
Contributor

I am not sure what is meant by "Expose BitMapBackendError to allow handling those errors". The error seems already publicly exposed.

@kangalio
Copy link
Author

kangalio commented Sep 3, 2022

Oh now it apparently is

It wasn't in 0.3.1 https://docs.rs/plotters-bitmap/0.3.1/plotters_bitmap/?search=BitMapBackendError

Would be nice to add this to the 0.3.2 changelog

@AaronErhardt
Copy link
Member

I think the list is complete now. Feel free to close this issue or comment if something is still missing :)

@kangalio kangalio closed this as completed Sep 5, 2022
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
Projects
None yet
Development

No branches or pull requests

4 participants