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

Conversation

Projects
None yet
2 participants
@alexcjohnson
Copy link
Contributor

commented Feb 27, 2018

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';

This comment has been minimized.

Copy link
@etpinard

etpinard Feb 27, 2018

Member

maybe a good candidate for a new addition to src/constants/ (e.g. blankPath)?

This comment has been minimized.

Copy link
@alexcjohnson

alexcjohnson Feb 28, 2018

Author Contributor

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();

This comment has been minimized.

Copy link
@etpinard

etpinard Feb 28, 2018

Member

What about axis titles? They are removed above in an old vs new axis loop, could we combine that in removeSubplotExtras?

This comment has been minimized.

Copy link
@alexcjohnson

alexcjohnson Feb 28, 2018

Author Contributor

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.

@alexcjohnson alexcjohnson referenced this pull request Feb 28, 2018

Merged

Subplots2 #357

@etpinard

This comment has been minimized.

Copy link
Member

commented Feb 28, 2018

Thanks for making 1.35.0 a pretty solid release 💃

@alexcjohnson alexcjohnson merged commit 4bcde5f into master Feb 28, 2018

5 checks passed

ci/circleci: build Your tests passed on CircleCI!
Details
ci/circleci: test-image Your tests passed on CircleCI!
Details
ci/circleci: test-jasmine Your tests passed on CircleCI!
Details
ci/circleci: test-jasmine2 Your tests passed on CircleCI!
Details
ci/circleci: test-syntax Your tests passed on CircleCI!
Details

@alexcjohnson alexcjohnson deleted the hide-axes branch Feb 28, 2018

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
You can’t perform that action at this time.