Skip to content

Cartesian subplot fixes #1049

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

Merged
merged 4 commits into from
Oct 18, 2016
Merged

Cartesian subplot fixes #1049

merged 4 commits into from
Oct 18, 2016

Conversation

etpinard
Copy link
Contributor

fixes #1044

and fixes relayout problems discovered in http://community.plot.ly/t/resizing-is-not-working-after-setting-height-in-plotly-relayout/2196/6?u=etienne

These problems were introduced in #946

This PR will need to merge master after #1048 to ✅

- so that old axis scale fields (e.g _length, _m, ...) in fullLayout
  don't get relinked in subplot objects, leading to incorrect
  relayout / resize.
- to make sure that subplot nodes have the correct
  mouse / click handlers.
@etpinard etpinard added bug something broken status: reviewable labels Oct 17, 2016
@etpinard
Copy link
Contributor Author

@rreusser would mind taking a 👁️ on this?

Copy link
Contributor

@rreusser rreusser left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Looks reasonable to me. I'll definitely want to fire up a couple test cases once merged to confirm that this has fixed things. I say 💃

@@ -402,6 +402,9 @@ plots.supplyDefaults = function(gd) {
// clean subplots and other artifacts from previous plot calls
plots.cleanPlot(newFullData, newFullLayout, oldFullData, oldFullLayout);

// relink / initialize subplot axis objects
plots.linkSubplots(newFullData, newFullLayout, oldFullData, oldFullLayout);
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Ah, so it was that the axes were outdated? That seems consistent with what was observed.

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Exactly.

@@ -630,6 +631,16 @@ describe('hover after resizing', function() {

afterEach(destroyGraphDiv);

function _click(pos) {
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

👍 for fixing via testing!

@@ -248,7 +248,7 @@ describe('Test Plots', function() {
describe('Plots.resize', function() {
var gd;

beforeEach(function(done) {
beforeAll(function(done) {
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Hmm… beforeAll? Usually when I've written that, it's not actually what I want. Does it leak state between the tests? Is it definitely what you meant here?

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Yep, this is on purpose.

This particular describe creates a graph then calls Plotly.Plots.resize. The multiple it block are simply there to group the assertion in some logical way. There's no need to re-create the graph before each it in this case.

expect(fullLayout.yaxis._length).toEqual(220);

expect(plotinfo.xaxis._length).toEqual(240);
expect(plotinfo.yaxis._length).toEqual(220);
Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

In particular @rreusser , these assertions were failing before f4ca110

Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Got it. Sounds good! I once misunderstood beforeAll to mean before each all tests, so thought it was worth checking!

@etpinard
Copy link
Contributor Author

@rreusser

I'll definitely want to fire up a couple test cases once merged to confirm that this has fixed things

Agreed. I would be nice to beef up our resize test suites. Let's first publish 1.18.1.

Thanks very much for reviewing this!

@rreusser
Copy link
Contributor

💃

@etpinard etpinard merged commit a96c298 into master Oct 18, 2016
@etpinard etpinard deleted the cartesian-relayout-fix branch October 18, 2016 13:25
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.

Interactivity breaks on click
2 participants