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

ticks.display: 'above' #6226

Closed
wants to merge 4 commits into from
Closed

Conversation

kurkle
Copy link
Member

@kurkle kurkle commented Apr 25, 2019

Allow drawing tick labels after datasets.

Fixes: #2808
Fixes: #3724
Fixes: #3738
Fixes: #3722

Demo

@etimberg etimberg requested review from simonbrunel, benmccann and nagix and removed request for benmccann April 26, 2019 00:20
etimberg
etimberg previously approved these changes Apr 26, 2019
Copy link
Contributor

@benmccann benmccann left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I'd probably call it above rather than top. Other than that it looks good to me. It'll need docs before merging


if (!me._isVisible()) {
if (!me._isVisible() || (top && optionTicks.display !== 'top')) {
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I'd probably have done this check in core.controller instead

Copy link
Member Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Not sure its worth digging in to box to see if its a scale and if its ticks should be drawn above in core.controller.
OTOH custom scales that don't implement this would be drawn twice now.
I'll look into this.

above instead of top makes more sense to me too.

@kurkle
Copy link
Member Author

kurkle commented Apr 26, 2019

Changed the option to 'above' instead of 'top'. Demo changed.

It gets cluttery and ugly fast checking ticks.display === 'above' in core.controller, so did not do that.
Also this leaves the possibility to add gridLines.display: 'above' for example, without any further changes to core.controller.

@kurkle kurkle changed the title ticks.display: 'top' ticks.display: 'above' Apr 26, 2019
Copy link
Member

@simonbrunel simonbrunel left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I don't think display is the correct option to control that behavior because everywhere else, display means visibility (not order). Also, scale.display: 'auto' && scale.display: 'top' would not work while it's a valid use case if we want to control the order at the scale level. The option name/values combination is also confusing to me because it can be understood as the drawing position (x, y) instead of the drawing order (z).

}, me);

me.drawDatasets(easingValue);

helpers.each(me.boxes, function(box) {
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I'm really not fan of this extra loop calling draw() a second time for all scales and as you said, it would draw existing custom scales 2 times. I don't think scales should be aware of the drawing order and check internally this extra argument "to draw or not to draw". IMO, draw() should be called only one time before or after datasets.

Copy link
Member

@simonbrunel simonbrunel left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Talked with @kurkle and we will investigate another approach to implement this feature (using layers). Let's keep that PR open but mark it as "Request changes" to prevent merging for now.

@kurkle
Copy link
Member Author

kurkle commented May 9, 2019

Closed via #6241

@kurkle kurkle closed this May 9, 2019
@kurkle kurkle deleted the ticks-display-top branch November 13, 2019 06:15
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
4 participants