Skip to content

Commit 65c2678

Browse files
committed
fix visible true|false toggle for pie traces
- probably a side-effect from a splom-perf PR
1 parent 5d981c2 commit 65c2678

File tree

2 files changed

+21
-2
lines changed

2 files changed

+21
-2
lines changed

src/traces/pie/base_plot.js

+1-2
Original file line numberDiff line numberDiff line change
@@ -16,8 +16,7 @@ exports.name = 'pie';
1616
exports.plot = function(gd) {
1717
var Pie = Registry.getModule('pie');
1818
var cdPie = getModuleCalcData(gd.calcdata, Pie)[0];
19-
20-
if(cdPie.length) Pie.plot(gd, cdPie);
19+
Pie.plot(gd, cdPie);
2120
};
2221

2322
exports.clean = function(newFullData, newFullLayout, oldFullData, oldFullLayout) {

test/jasmine/tests/pie_test.js

+20
Original file line numberDiff line numberDiff line change
@@ -818,6 +818,26 @@ describe('Pie traces', function() {
818818
.catch(failTest)
819819
.then(done);
820820
});
821+
822+
it('should be able to toggle visibility', function(done) {
823+
var mock = Lib.extendDeep({}, require('@mocks/pie_title_multiple.json'));
824+
825+
function _assert(msg, exp) {
826+
return function() {
827+
var layer = d3.select(gd).select('.pielayer');
828+
expect(layer.selectAll('.trace').size()).toBe(exp, msg);
829+
};
830+
}
831+
832+
Plotly.plot(gd, mock)
833+
.then(_assert('base', 4))
834+
.then(function() { return Plotly.restyle(gd, 'visible', false); })
835+
.then(_assert('both visible:false', 0))
836+
.then(function() { return Plotly.restyle(gd, 'visible', true); })
837+
.then(_assert('back to visible:true', 4))
838+
.catch(failTest)
839+
.then(done);
840+
});
821841
});
822842

823843
describe('pie hovering', function() {

0 commit comments

Comments
 (0)