-
-
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
Enable restyle to redraw parcoords #3101 #3125
Conversation
Alright, at some point we should dive in and figure out what it will take to make |
@@ -7,6 +7,7 @@ var click = require('../assets/click'); | |||
var mouseEvent = require('../assets/mouse_event'); | |||
var failTest = require('../assets/fail_test'); | |||
var delay = require('../assets/delay'); | |||
var RESIZE_DELAY = 300; |
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.
cc @antoinerg - bad day for circleci it seems, we were getting repeated test failures here so I encouraged @archmoj to try increasing this delay. At some point we may want to change this so we're waiting on some event (listen for plotly_afterplot
perhaps?) rather than a fixed delay, that should be more robust (and usually faster!)
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.
@antoinerg What value you suggest we use here for RESIZE_DELAY
now that the CI is back to normal?
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.
Don't bother reducing it (if the goal is essentially to save time) - just leave it until we get around to exploring an event-based delay, rather than time-based.
The restyle function is tested interactively. Do we still need to create a jasmine test? |
Yes - especially since at some point we want to improve performance by fixing |
There was a test available for colorscale; so I added another one for line color. |
Hmm, those tests only really verify the mechanics inside We need both of those tests to check what's actually on screen after the change, probably by using |
Yes totally agree on that. |
src/traces/parcoords/parcoords.js
Outdated
if(d.viewModel) { | ||
if(d.lineLayer) d.lineLayer.update(d); | ||
else d.lineLayer = lineLayerMaker(this, d); | ||
if((!d.lineLayer) || |
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.
That extra ( )
style feels somewhat new to our codebase. Maybe we could add https://eslint.org/docs/rules/no-extra-parens to our lintinting rules.
Yes, most likely specifically fa1a436 |
@etpinard |
Very interesting. FF must not like this block plotly.js/src/plot_api/plot_api.js Lines 261 to 279 in 7ae6fd6
added in #2939 Could you check if |
On FF when width and height are not declared in the layout we get float values (e.g. fullLayout.width) that we shouldn't get. So they could be rounded somewhere upstream? by either floor function or another round to nearest function. What do you think @etpinard ? |
@archmoj do you need help adding a test for this thing? This is a pretty bad bug that we should merge in before releasing 1.42.0 |
Thank you! Yes actually I am working on a jasmine test for this. I would let you know. |
test/jasmine/tests/parcoords_test.js
Outdated
|
||
canvases.each(function(element, index) { | ||
|
||
if (index == 0) { // FIXME: we assumed here that the context is the first item but may be not. |
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.
Yes, the context should always be the first one, if it's not maybe other tests will fail (not just this one). No need to for an additional check.
var canvases = d3.selectAll('.gl-canvas'); | ||
expect(canvases.size()).toBe(3, msg); | ||
|
||
canvases.each(function(element, index) { |
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.
... but alternatively, you could select .gl-canvas-context
instead of all three <canvas>
elements
test/jasmine/tests/parcoords_test.js
Outdated
var b = imageArray[i][2]; | ||
totalRGB += r + g + b; | ||
} | ||
if(secondPass > 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.
I don't like this pattern. Let's keep getGrayRatio
as just a getter function and move the expect
statement to down to it
block below:
var totalRGB;
Plotly.plot(gd, mock3)
.then(function() {
totalRGB = _getGrayRatio();
mockCopy.data[0].dimensions[1].constraintrange = [0.4, 0.6];
return Plotly.react(gd, mockCopy);
})
.then(function() {
var totalRGB2 = _getGrayRatio();
expect(totalRGB2).toBe(totalRGB, 'after react');
})
.catch(failTest)
.then(done);
package-lock.json
Outdated
@@ -17,7 +17,7 @@ | |||
"3d-view-controls": { | |||
"version": "2.2.2", | |||
"resolved": "https://registry.npmjs.org/3d-view-controls/-/3d-view-controls-2.2.2.tgz", | |||
"integrity": "sha512-WL0u3PN41lEx/4qvKqV6bJlweUYoW18FXMshW/qHb41AVdZxDReLoJNGYsI7x6jf9bYelEF62BJPQmO7yEnG2w==", | |||
"integrity": "sha1-cXP8GX6efk28YyE0OEZwR9vIT6I=", |
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.
Can you undo these package-lock changes? They have nothing to do with this PR.
Now in #3178 |
This PR enables callbacks e.g. restyle to redraw parcoords.
This fixes #3101
@alexcjohnson