-
-
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
scattergl visible restyle fix #2442
Merged
Merged
Changes from 1 commit
Commits
Show all changes
6 commits
Select commit
Hold shift + click to select a range
5c6576a
fix #2441 - don't attempt to draw empty option items
etpinard 187ac23
fixup - no need to override opacity editType twice
etpinard 91cac2e
DRY up scattergl
etpinard 687a1f5
Merge branch 'master' into scattergl-visible-fix
etpinard a98d1d5
bring back scene.update + :lock: down its used during drag
etpinard 4776832
no need to extendFlat attrs that 'only' get overrode by overrideAll
etpinard File filter
Filter by extension
Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
|
@@ -379,6 +379,48 @@ describe('@gl Test gl2d plots', function() { | |
.then(done); | ||
}); | ||
|
||
it('should be able to toggle trace with different modes', function(done) { | ||
Plotly.newPlot(gd, [{ | ||
// a trace with all regl2d objects | ||
type: 'scattergl', | ||
y: [1, 2, 1], | ||
error_x: {value: 10}, | ||
error_y: {value: 10}, | ||
fill: 'tozeroy' | ||
}, { | ||
type: 'scattergl', | ||
mode: 'markers', | ||
y: [0, 1, -1] | ||
}]) | ||
.then(function() { | ||
var scene = gd._fullLayout._plots.xy._scene; | ||
spyOn(scene.fill2d, 'draw'); | ||
spyOn(scene.line2d, 'draw'); | ||
spyOn(scene.error2d, 'draw'); | ||
spyOn(scene.scatter2d, 'draw'); | ||
|
||
return Plotly.restyle(gd, 'visible', 'legendonly', [0]); | ||
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. |
||
}) | ||
.then(function() { | ||
var scene = gd._fullLayout._plots.xy._scene; | ||
expect(scene.fill2d.draw).toHaveBeenCalledTimes(0); | ||
expect(scene.line2d.draw).toHaveBeenCalledTimes(0); | ||
expect(scene.error2d.draw).toHaveBeenCalledTimes(0); | ||
expect(scene.scatter2d.draw).toHaveBeenCalledTimes(1); | ||
|
||
return Plotly.restyle(gd, 'visible', true, [0]); | ||
}) | ||
.then(function() { | ||
var scene = gd._fullLayout._plots.xy._scene; | ||
expect(scene.fill2d.draw).toHaveBeenCalledTimes(1); | ||
expect(scene.line2d.draw).toHaveBeenCalledTimes(1); | ||
expect(scene.error2d.draw).toHaveBeenCalledTimes(2, 'twice for x AND y'); | ||
expect(scene.scatter2d.draw).toHaveBeenCalledTimes(3, 'both traces have markers'); | ||
}) | ||
.catch(fail) | ||
.then(done); | ||
}); | ||
|
||
it('@noCI should display selection of big number of regular points', function(done) { | ||
// generate large number of points | ||
var x = [], y = [], n = 2e2, N = n * n; | ||
|
Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
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.
Clear improvement over
master
- but this does raise the question of whether this (not your change, but the structure surrounding it) is really the right behavior, particularly withfill: 'tonext'
but also with multiple fills to zero. I can try this out tomorrow and see if my interpretation of what this is doing is accurate, but In svgscatter
, each fill gets drawn below any trace that it's attached to (even the trace before it if it's afill: 'tonext'
) but above any other trace that comes before it. If all the lines and points are above all the fills, you can get points and lines that look disconnected from their own fills.