-
Notifications
You must be signed in to change notification settings - Fork 281
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
Boxplot element and category coordinate have been added. #83
Conversation
Squashed commit of the following: Added testing notes. Added the test coverage for the changed code. Added documentation. TextAlignment enum has been added to be used as a hint for the rendering. Category coord has been added. Added explicit Quartiles struct. Initial Boxplot element has been added.
Codecov Report
@@ Coverage Diff @@
## master #83 +/- ##
==========================================
+ Coverage 52.39% 55.84% +3.44%
==========================================
Files 47 50 +3
Lines 4321 4570 +249
==========================================
+ Hits 2264 2552 +288
+ Misses 2057 2018 -39
Continue to review full report at Codecov.
|
Thanks for the contribution, this is a pretty concrete one! Few more questions:
This looks awesome, but a little bit confusing to me when I look at this first time.
I think it's really good, I am thinking about this for a long time. It seems some of your code in this part: 1. get size of the category, 2. convert index to value 3. convert value to index, is used to describe some discrete coord spec and this is exactly what I am going to do when refactoring the discrete trait. By then, I think this coord can be simplified tremendously. |
It's completely up to you, I just needed to somehow present the labels and that's the only way I could do it. I'm sure you can do it much better :) I can even remove it from this PR and just left it in my own branch (as I need it right away, and thankfully Cargo can refer to github branches). |
I think I just decided to keep it and replace it when 0.3 released. So that's looks fine to me for now :) |
- the boxplot example have been fixed to draw the series in a sorted order and use `draw_series` API rather than direct calls to area API; - area `titled` use center alignment now; - TextAlignment description have been clarified to mention invariant points.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
it looks good to me, just have some minor thing.
One thing I feel the most important thing is we need to document TextAlignment
a little bit more, since the purpose for this is not obvious to everybody.
It's up to you to make the change, since it's all minor thing. If you don't want to change it, I can resolve them it before I merge it.
Thanks again for this great work! Cheers!
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
It looks good, but we can do further simplification on the Category part. I have tried that and I just want to make a PR on your PR that makes category simplier. After that I think we are good to go.
Thanks!
/// The category elements range. | ||
pub struct CategoryElementsRange<T: PartialEq>(CategoryElementRef<T>, CategoryElementRef<T>); | ||
/// The category elements range | ||
pub struct CategoryElementsRange<T: PartialEq>(Category<T>, Category<T>); |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I am thinking about this, as long as we only using all values in a Category
as an range. It seems this range also can be merged into Category
type.
It's just minor change, I'd like to make a PR to you to show what I mean :)
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Thank you, I'd appreciate it!
Just Merged the PR. Thanks for the contribution. Really appreciated for this concrete work. :) |
@nuald |
Major changes:
Quartiles
data object has been added (without outliers support as they are not used so much, but could consume a lot of memory and could have the performance penalty);Boxplot
element has been added (that draws the quartiles);Category
coordinate has been added (as boxplots are usually used for categorical views).The corresponding example has been added (please note that it support the external data too as I've used it to verify how the dataset with few million rows is going to be calculated and presented). Unfortunately, changing the main
README.md
with an example image and its link would require a commit into the other repo, so it's out of scope of this PR.Minor changes:
TextAlignment
enum has been added as a hint for the rendering engines (used for SVG so far). SVG is rendered on the client side, so the layout based on fonts provided by fontkit is not always correct as the client side may use different fonts. The proper fix could be changing the signature ofdraw_text
to use text style and rectangle, so the renderer would calculate the layout by itself, but it's rather a big change that could affect the performance (actually it may improve performance as certain engines don't require pre-calculation of a text block layout).clippy
for my changes). While some disabled warnings could be properly addressed, that could have the performance penalty and would require careful approach.CONTRIBUTING.md
for the future references.