Skip to content
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

Histogram autobin #3044

Merged
merged 10 commits into from
Oct 4, 2018
5 changes: 4 additions & 1 deletion src/plots/plots.js
Original file line number Diff line number Diff line change
Expand Up @@ -1482,7 +1482,10 @@ plots.supplyLayoutModuleDefaults = function(layoutIn, layoutOut, fullData, trans
}

// trace module layout defaults
var modules = layoutOut._visibleModules;
// use _modules rather than _visibleModules so that even
// legendonly traces can include settings - eg barmode, which affects
// legend.traceorder default value.
var modules = layoutOut._modules;
etpinard marked this conversation as resolved.
Show resolved Hide resolved
for(i = 0; i < modules.length; i++) {
_module = modules[i];

Expand Down
12 changes: 12 additions & 0 deletions test/jasmine/tests/bar_test.js
Original file line number Diff line number Diff line change
Expand Up @@ -1361,6 +1361,7 @@ describe('bar visibility toggling:', function() {
spyOn(gd._fullData[0]._module, 'crossTraceCalc').and.callThrough();

_assert('base', [0.5, 3.5], [-2.222, 2.222], 0);
expect(gd._fullLayout.legend.traceorder).toBe('normal');
return Plotly.restyle(gd, 'visible', false, [1]);
})
.then(function() {
Expand All @@ -1369,6 +1370,11 @@ describe('bar visibility toggling:', function() {
})
.then(function() {
_assert('both invisible', [0.5, 3.5], [0, 2.105], 0);
return Plotly.restyle(gd, 'visible', 'legendonly');
})
.then(function() {
_assert('both legendonly', [0.5, 3.5], [0, 2.105], 0);
expect(gd._fullLayout.legend.traceorder).toBe('normal');
return Plotly.restyle(gd, 'visible', true, [1]);
})
.then(function() {
Expand All @@ -1391,6 +1397,7 @@ describe('bar visibility toggling:', function() {
spyOn(gd._fullData[0]._module, 'crossTraceCalc').and.callThrough();

_assert('base', [0.5, 3.5], [0, 5.263], 0);
expect(gd._fullLayout.legend.traceorder).toBe('reversed');
return Plotly.restyle(gd, 'visible', false, [1]);
})
.then(function() {
Expand All @@ -1399,6 +1406,11 @@ describe('bar visibility toggling:', function() {
})
.then(function() {
_assert('both invisible', [0.5, 3.5], [0, 2.105], 0);
return Plotly.restyle(gd, 'visible', 'legendonly');
})
.then(function() {
_assert('both legendonly', [0.5, 3.5], [0, 2.105], 0);
expect(gd._fullLayout.legend.traceorder).toBe('reversed');
return Plotly.restyle(gd, 'visible', true, [1]);
})
.then(function() {
Expand Down