-
-
Notifications
You must be signed in to change notification settings - Fork 1.9k
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
Cartesian subplot fixes #1049
Conversation
- 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.
@rreusser would mind taking a 👁️ on this? |
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.
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); |
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.
Ah, so it was that the axes were outdated? That seems consistent with what was observed.
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.
Exactly.
@@ -630,6 +631,16 @@ describe('hover after resizing', function() { | |||
|
|||
afterEach(destroyGraphDiv); | |||
|
|||
function _click(pos) { |
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.
👍 for fixing via testing!
@@ -248,7 +248,7 @@ describe('Test Plots', function() { | |||
describe('Plots.resize', function() { | |||
var gd; | |||
|
|||
beforeEach(function(done) { | |||
beforeAll(function(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.
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?
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.
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); |
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.
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.
Got it. Sounds good! I once misunderstood beforeAll
to mean before each all tests, so thought it was worth checking!
Agreed. I would be nice to beef up our resize test suites. Let's first publish Thanks very much for reviewing this! |
💃 |
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 ✅