@@ -300,9 +300,10 @@ drawing.gradient = function(sel, gd, gradientID, type, colorscale, prop) {
300300 }
301301 }
302302
303- var fullID = 'g' + gd . _fullLayout . _uid + '-' + gradientID ;
303+ var fullLayout = gd . _fullLayout ;
304+ var fullID = 'g' + fullLayout . _uid + '-' + gradientID ;
304305
305- var gradient = gd . _fullLayout . _defs . select ( '.gradients' )
306+ var gradient = fullLayout . _defs . select ( '.gradients' )
306307 . selectAll ( '#' + fullID )
307308 . data ( [ type + colorStops . join ( ';' ) ] , Lib . identity ) ;
308309
@@ -333,6 +334,13 @@ drawing.gradient = function(sel, gd, gradientID, type, colorscale, prop) {
333334
334335 sel . style ( prop , getFullUrl ( fullID , gd ) )
335336 . style ( prop + '-opacity' , null ) ;
337+
338+ var className2query = function ( s ) {
339+ return '.' + s . attr ( 'class' ) . replace ( / \s / g, '.' ) ;
340+ } ;
341+ var k = className2query ( d3 . select ( sel . node ( ) . parentNode ) ) +
342+ '>' + className2query ( sel ) ;
343+ fullLayout . _gradientUrlQueryParts [ k ] = 1 ;
336344} ;
337345
338346/*
@@ -343,8 +351,14 @@ drawing.gradient = function(sel, gd, gradientID, type, colorscale, prop) {
343351 * The upside of this is arbitrary points can share gradient defs
344352 */
345353drawing . initGradients = function ( gd ) {
346- var gradientsGroup = Lib . ensureSingle ( gd . _fullLayout . _defs , 'g' , 'gradients' ) ;
354+ var fullLayout = gd . _fullLayout ;
355+
356+ var gradientsGroup = Lib . ensureSingle ( fullLayout . _defs , 'g' , 'gradients' ) ;
347357 gradientsGroup . selectAll ( 'linearGradient,radialGradient' ) . remove ( ) ;
358+
359+ // initialize stash of query parts filled in Drawing.gradient,
360+ // used to fix URL strings during image exports
361+ fullLayout . _gradientUrlQueryParts = { } ;
348362} ;
349363
350364
0 commit comments