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

Clean up removed axes and axis lines #2416

Merged
merged 2 commits into from
Feb 28, 2018
Merged

Clean up removed axes and axis lines #2416

merged 2 commits into from
Feb 28, 2018

Conversation

alexcjohnson
Copy link
Collaborator

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

@@ -272,6 +272,7 @@ exports.lsInner = function(gd) {
* -----
* x2
*/
var xPath = 'M0,0';
Copy link
Contributor

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)?

Copy link
Collaborator Author

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();
Copy link
Contributor

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?

Copy link
Collaborator Author

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.

@etpinard
Copy link
Contributor

Thanks for making 1.35.0 a pretty solid release 💃

@alexcjohnson alexcjohnson merged commit 4bcde5f into master Feb 28, 2018
@alexcjohnson alexcjohnson deleted the hide-axes branch February 28, 2018 14:20
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
bug something broken
Projects
None yet
Development

Successfully merging this pull request may close these issues.

2 participants