@@ -25,6 +25,7 @@ var Polar = require('../plots/polar');
25
25
var initInteractions = require ( '../plots/cartesian/graph_interact' ) ;
26
26
27
27
var Drawing = require ( '../components/drawing' ) ;
28
+ var Color = require ( '../components/color' ) ;
28
29
var ErrorBars = require ( '../components/errorbars' ) ;
29
30
var xmlnsNamespaces = require ( '../constants/xmlns_namespaces' ) ;
30
31
var svgTextUtils = require ( '../lib/svg_text_utils' ) ;
@@ -390,10 +391,17 @@ Plotly.plot = function(gd, data, layout, config) {
390
391
} ) ;
391
392
} ;
392
393
394
+ function setBackground ( gd , bgColor ) {
395
+ try {
396
+ gd . _fullLayout . _paper . style ( 'background' , bgColor ) ;
397
+ } catch ( e ) {
398
+ Lib . error ( e ) ;
399
+ }
400
+ }
393
401
394
402
function opaqueSetBackground ( gd , bgColor ) {
395
403
gd . _fullLayout . _paperdiv . style ( 'background' , 'white' ) ;
396
- Plotly . defaultConfig . setBackground ( gd , bgColor ) ;
404
+ setBackground ( gd , bgColor ) ;
397
405
}
398
406
399
407
function setPlotContext ( gd , config ) {
@@ -460,6 +468,11 @@ function setPlotContext(gd, config) {
460
468
if ( context . displayModeBar === 'hover' && ! hasHover ) {
461
469
context . displayModeBar = true ;
462
470
}
471
+
472
+ // default and fallback for setBackground
473
+ if ( context . setBackground === 'transparent' || typeof context . setBackground !== 'function' ) {
474
+ context . setBackground = setBackground ;
475
+ }
463
476
}
464
477
465
478
function plotPolar ( gd , data , layout ) {
0 commit comments