Skip to content

Commit 8a77adf

Browse files
authored
Merge pull request #921 from plotly/paper_bgcolor-legend
make paper bgcolor relayout update legend and updatemenu accordingly
2 parents 923797a + 7ef9806 commit 8a77adf

File tree

3 files changed

+17
-0
lines changed

3 files changed

+17
-0
lines changed

src/plot_api/plot_api.js

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1948,6 +1948,7 @@ function _relayout(gd, aobj) {
19481948
if(p.parts[0].indexOf('scene') === 0) flags.doplot = true;
19491949
else if(p.parts[0].indexOf('geo') === 0) flags.doplot = true;
19501950
else if(p.parts[0].indexOf('ternary') === 0) flags.doplot = true;
1951+
else if(ai === 'paper_bgcolor') flags.doplot = true;
19511952
else if(fullLayout._has('gl2d') &&
19521953
(ai.indexOf('axis') !== -1 || p.parts[0] === 'plot_bgcolor')
19531954
) flags.doplot = true;

test/jasmine/tests/legend_test.js

Lines changed: 8 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -537,6 +537,14 @@ describe('legend relayout update', function() {
537537
}).then(function() {
538538
assertLegendStyle('rgb(0, 0, 255)', 'rgb(255, 0, 0)', 10);
539539

540+
return Plotly.relayout(gd, 'legend.bgcolor', null);
541+
}).then(function() {
542+
assertLegendStyle('rgb(255, 255, 255)', 'rgb(255, 0, 0)', 10);
543+
544+
return Plotly.relayout(gd, 'paper_bgcolor', 'blue');
545+
}).then(function() {
546+
assertLegendStyle('rgb(0, 0, 255)', 'rgb(255, 0, 0)', 10);
547+
540548
done();
541549
});
542550
});

test/jasmine/tests/updatemenus_test.js

Lines changed: 8 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -348,6 +348,14 @@ describe('update menus interactions', function() {
348348
// fold up buttons whenever new menus are added
349349
assertMenus([0, 0]);
350350

351+
return Plotly.relayout(gd, {
352+
'updatemenus[0].bgcolor': null,
353+
'paper_bgcolor': 'black'
354+
});
355+
}).then(function() {
356+
assertItemColor(selectHeader(0), 'rgb(0, 0, 0)');
357+
assertItemColor(selectHeader(1), 'rgb(0, 0, 0)');
358+
351359
done();
352360
});
353361
});

0 commit comments

Comments
 (0)