-
-
Notifications
You must be signed in to change notification settings - Fork 1.9k
better zooming behavior for errorbars, bars, and box plots #1897
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
Changes from all commits
File filter
Filter by extension
Conversations
Jump to
Diff view
Diff view
There are no files selected for viewing
Original file line number | Diff line number | Diff line change |
---|---|---|
|
@@ -747,7 +747,7 @@ module.exports = function dragBox(gd, plotinfo, x, y, w, h, ns, ew) { | |
.call(Drawing.setTranslate, clipDx, clipDy) | ||
.call(Drawing.setScale, xScaleFactor2, yScaleFactor2); | ||
|
||
var scatterPoints = subplot.plot.select('.scatterlayer').selectAll('.points'); | ||
var scatterPoints = subplot.plot.selectAll('.scatterlayer .points, .boxlayer .points'); | ||
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. Nice touch 👌 |
||
|
||
subplot.plot | ||
.call(Drawing.setTranslate, plotDx, plotDy) | ||
|
Original file line number | Diff line number | Diff line change |
---|---|---|
|
@@ -124,8 +124,10 @@ module.exports = function plot(gd, plotinfo, cdbar) { | |
// append bar path and text | ||
var bar = d3.select(this); | ||
|
||
bar.append('path').attr('d', | ||
'M' + x0 + ',' + y0 + 'V' + y1 + 'H' + x1 + 'V' + y0 + 'Z'); | ||
bar.append('path') | ||
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. Non- ⛔ comment What about bar text labels? they probably would benefit from the same tricks scatter text nodes get on scroll There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. These are also tricky - as sometimes they will scale up, sometimes they won't, and sometimes they'll move or rotate after the zoom. Also I played around with including them and the element structure isn't quite set up the same way as scatter text points so it's nontrivial to make it work. I'll add this to the list of possible future improvements. |
||
.style('vector-effect', 'non-scaling-stroke') | ||
.attr('d', | ||
'M' + x0 + ',' + y0 + 'V' + y1 + 'H' + x1 + 'V' + y0 + 'Z'); | ||
|
||
appendBarText(gd, bar, d, i, x0, x1, y0, y1); | ||
}); | ||
|
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.
Something still looks off:
Looks like the whiskers appear thicker during zooms.
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.
right - because that's about the length of the whisker, not its stroke. I couldn't think of a way to handle this at first but now that you mention it, I suppose we could have the
x
scale of they
errorbars (and they
scale ofx
error bars) get inverse-scaled the same way as we do for both x and y scales of the points... I can look into this but it may take a little more work, do you think it's worth holding up this PR or shall I tackle it separately later?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.
Thanks for clarification 📚
Not worth holding up this PR. 👍
Opening a new issue will be just fine.