-
-
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
Clean up removed axes and axis lines #2416
Conversation
@@ -272,6 +272,7 @@ exports.lsInner = function(gd) { | |||
* ----- | |||
* x2 | |||
*/ | |||
var xPath = 'M0,0'; |
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.
maybe a good candidate for a new addition to src/constants/
(e.g. blankPath
)?
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.
We do use it a fair amount... though we use it for purposes other than just blank (as the start of a real path for example), and between the open 'M0,0'
and closed M0,0Z
variants (though maybe we don't need the closed one and could switch to open?), I feel like hiding it in a constant may make its purpose less clear rather than more.
@@ -515,6 +524,11 @@ function purgeSubplotLayers(layers, fullLayout) { | |||
} | |||
} | |||
|
|||
function removeSubplotExtras(subplotId, fullLayout) { | |||
fullLayout._draggers.selectAll('g.' + subplotId).remove(); | |||
fullLayout._defs.select('#clip' + fullLayout._uid + subplotId + 'plot').remove(); |
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.
What about axis titles? They are removed above in an old vs new axis loop, could we combine that in removeSubplotExtras
?
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.
Titles are per axis, because there's only ever one copy per axis, so they're inserted with no reference to the subplot and it would be incorrect to tie their removal to the disappearance of any given subplot.
Thanks for making |
Fixes #2410 - hide axis lines that have been removed - this one was straightforward, just needed to move the path attr setter out to where it's always called
Fixes #2392 - this one is a bit more complicated, it's hard to figure out a reasonable d3-idiomatic way to do this because it's not obvious where the axis objects that we need to remove had been created in the first place, ie independent or overlaying some other axis. In principle we should refactor the d3 data for drawing axes to reflect this structure, but for now I just added some more explicit cleanup code.
cc @etpinard @nicolaskruchten