-
-
Notifications
You must be signed in to change notification settings - Fork 1.9k
scattergl visible restyle fix #2442
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
Changes from 2 commits
5c6576a
187ac23
91cac2e
687a1f5
a98d1d5
4776832
File filter
Filter by extension
Conversations
Jump to
Diff view
Diff view
There are no files selected for viewing
Original file line number | Diff line number | Diff line change |
---|---|---|
|
@@ -556,21 +556,24 @@ function sceneUpdate(gd, subplot) { | |
scene.draw = function draw() { | ||
var i; | ||
for(i = 0; i < scene.count; i++) { | ||
if(scene.fill2d) scene.fill2d.draw(i); | ||
if(scene.fill2d && scene.fillOptions[i]) { | ||
// must do all fills first | ||
scene.fill2d.draw(i); | ||
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. Clear improvement over |
||
} | ||
} | ||
for(i = 0; i < scene.count; i++) { | ||
if(scene.line2d) { | ||
if(scene.line2d && scene.lineOptions[i]) { | ||
scene.line2d.draw(i); | ||
} | ||
if(scene.error2d) { | ||
if(scene.error2d && scene.errorXOptions[i]) { | ||
scene.error2d.draw(i); | ||
} | ||
if(scene.error2d && scene.errorYOptions[i]) { | ||
scene.error2d.draw(i + scene.count); | ||
} | ||
if(scene.scatter2d) { | ||
if(scene.scatter2d && scene.markerOptions[i] && (!scene.selectBatch || !scene.selectBatch[i])) { | ||
// traces in no-selection mode | ||
if(!scene.selectBatch || !scene.selectBatch[i]) { | ||
scene.scatter2d.draw(i); | ||
} | ||
scene.scatter2d.draw(i); | ||
} | ||
} | ||
|
||
|
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; | ||
|
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.
you don't even need the
extendFlat
, right?overrideAll
will take care of that.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.
done in 4776832