-
-
Notifications
You must be signed in to change notification settings - Fork 1.9k
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
Implement axis.layer
with 'above traces' and 'below traces' values
#1871
Conversation
- which is more meaningul - other misc lint
- has 2 possible values: 'above traces' and 'below traces' for now, but opens the door for other values down the road.
- show off `(x|y)axis.layer` - lock down behavior for `cliponaxis: true` traces on hasClipOnAxisFalse subplot - add annotations for more descriptive mock
That's fine, I'll make an issue for the IE/Edge one since it's not new. For the chrome issue since it IS new, can you investigate a little (perhaps reduce it to a static SVG bug in codepen?) and then either make an internal issue or report it to chromium? |
}) | ||
.catch(failTest) | ||
.then(done); | ||
}); |
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.
Beautiful. This test is exactly the question I was about to ask when looking at the code.
'Sets the layer on which this axis is displayed.', | ||
'If *above traces*, this axis is displayed above all the subplot\'s traces', | ||
'If *below traces*, this axis is displayed below all the subplot\'s traces,', | ||
'but above the grid lines.' |
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.
Per #1861 (comment) - can you mention scatter.cliponaxis
here (and vice versa)?
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.
Good call 📚
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.
done in 6f494c6
- which replaces all `require('d3')` with `require('./strict-d3')` - so that strict-d3.js can more easily be used across all our tools - activate when bundling plotly.js in jasmine tests, `npm run watch` and `npm run cibuild` - 🔪 <script> injecting old IIFE - require('fast-isnumeric') in strict-d3.js
- instead of on <clipPath> element itself - see https://codepen.io/etpinard/pen/eRbxrp for more info on the problem - lock down this rule by adding condition in strict-d3.js
* Transform `require('d3')` expressions to `require(/path/to/strict-d3.js)` | ||
*/ | ||
|
||
module.exports = transformTools.makeRequireTransform('requireTransform', |
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.
@alexcjohnson I hope you don't mind this commit too much. This made incorporating strict-d3.js
in our jasmine tests a lot easier - which is very useful e.g. to 🔒 down e234827
Companion plotly-mock-viewer
PR: rreusser/plotly-mock-viewer#15
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.
yeah, looks great!
test/image/strict-d3.js
Outdated
function checkAttrVal(sel, key) { | ||
// setting the transform attribute on a <clipPath> does not | ||
// work in Chrome, IE and Edge | ||
if(sel.node().nodeName === 'clipPath' && key === 'transform') { |
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.
No need for additional jasmine tests cases, this here made many animation and interaction test fail.
@@ -743,7 +743,7 @@ module.exports = function dragBox(gd, plotinfo, x, y, w, h, ns, ew) { | |||
var plotDx = xa2._offset - clipDx / xScaleFactor2, | |||
plotDy = ya2._offset - clipDy / yScaleFactor2; | |||
|
|||
fullLayout._defs.selectAll('#' + subplot.clipId) | |||
fullLayout._defs.select('#' + subplot.clipId + '> rect') |
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.
See https://codepen.io/etpinard/pen/eRbxrp?editors=1010 for more info on this topic.
var pathIn = args[0]; | ||
var pathOut; | ||
|
||
if(pathIn === 'd3' && opts.file !== pathToStrictD3Module) { |
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 gather this is so that strict-d3 itself can still get the original d3?
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.
Bingo. 🎲
💃 |
to be merged in #1861 with (hopefully) all the requirements for #1385
This PR adds an axis attribute
layer
with two possible values:'above traces'
(the default and current behavior) and'below traces
' which allows together withcliponaxis: false
to draw markers and text nodes above axis lines and tick labels. Seecliponaxis_false
mock in e44aa4d for an example.We chose to make
layer
have a hard'above traces'
default value corresponding to the behavior onmaster
. This might be revisited inv2
.This PR also fixes a bug in the
cliponaxis: false
implementation in 7b62b73 and lints a few things.In a private convo with @alexcjohnson , we opted to not include special auto-range logic for
cliponaxis: false
traces. This issue will be dealt with by having a few more axis options in a later PR. I'll open up a ticket about this tomorrow. DONE in #1876Unless someone ⛔ me,
I'll won't add a workaround patch for the cartesian line clip path problems on pan (see #1861 (comment)) nor will I fix the IE / Edge issues from #1861 (comment). In trying to fix these, I broke some animation tests; I think it would be wise to wait until Ricky is back to working full-time before making another attempt. I'll document this things in new separate issues tomorrow.FIXED in e234827