From 375ff11a6144ddf944f577ea245275f23ad3a02d Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?=C3=89tienne=20T=C3=A9treault-Pinard?= Date: Tue, 17 Jan 2017 10:46:31 -0500 Subject: [PATCH 1/4] rm cartesian bg layer in range slider range plot - it was causing pdf/eps export to fail because the node didn't have x/y/width/height attributes - remove it as the range slider bg is all we need here --- src/components/rangeslider/draw.js | 4 +++- 1 file changed, 3 insertions(+), 1 deletion(-) diff --git a/src/components/rangeslider/draw.js b/src/components/rangeslider/draw.js index c82c8b6f4be..05fbacf21b1 100644 --- a/src/components/rangeslider/draw.js +++ b/src/components/rangeslider/draw.js @@ -377,7 +377,9 @@ function drawRangePlot(rangeSlider, gd, axisOpts, opts) { Cartesian.rangePlot(gd, plotinfo, filterRangePlotCalcData(calcData, id)); - if(isMainPlot) plotinfo.bg.call(Color.fill, opts.bgcolor); + // no need for the bg layer, + // drawBg handles coloring the background + if(isMainPlot) plotinfo.bg.remove(); }); } From 862465a20c83f00e9317fdb902a75a985d6faa7a Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?=C3=89tienne=20T=C3=A9treault-Pinard?= Date: Tue, 17 Jan 2017 10:48:00 -0500 Subject: [PATCH 2/4] color range slider mask rect with Color.fill - so that rgba color is set as: `fill: ${rgb}` + `fill-opacity: ${alpha}` for compatibility with eps/pdf exports --- src/components/rangeslider/draw.js | 14 ++++++-------- 1 file changed, 6 insertions(+), 8 deletions(-) diff --git a/src/components/rangeslider/draw.js b/src/components/rangeslider/draw.js index 05fbacf21b1..88ab5a75306 100644 --- a/src/components/rangeslider/draw.js +++ b/src/components/rangeslider/draw.js @@ -406,10 +406,9 @@ function drawMasks(rangeSlider, gd, axisOpts, opts) { .classed(constants.maskMinClassName, true) .attr({ x: 0, y: 0 }); - maskMin.attr({ - height: opts._height, - fill: constants.maskColor - }); + maskMin + .attr('height', opts._height) + .call(Color.fill, constants.maskColor); var maskMax = rangeSlider.selectAll('rect.' + constants.maskMaxClassName) .data([0]); @@ -418,10 +417,9 @@ function drawMasks(rangeSlider, gd, axisOpts, opts) { .classed(constants.maskMaxClassName, true) .attr('y', 0); - maskMax.attr({ - height: opts._height, - fill: constants.maskColor - }); + maskMax + .attr('height', opts._height) + .call(Color.fill, constants.maskColor); } function drawSlideBox(rangeSlider, gd, axisOpts, opts) { From 841667e73cd7d27ceb3577b5ab3e9af9f8fbbf71 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?=C3=89tienne=20T=C3=A9treault-Pinard?= Date: Tue, 17 Jan 2017 10:49:14 -0500 Subject: [PATCH 3/4] don't draw range slider slide + grab area box in static plots - these were also no exporting to pdf/eps well as they used a `fill: 'transparent` style --- src/components/rangeslider/draw.js | 4 ++++ 1 file changed, 4 insertions(+) diff --git a/src/components/rangeslider/draw.js b/src/components/rangeslider/draw.js index 88ab5a75306..ded3198d316 100644 --- a/src/components/rangeslider/draw.js +++ b/src/components/rangeslider/draw.js @@ -423,6 +423,8 @@ function drawMasks(rangeSlider, gd, axisOpts, opts) { } function drawSlideBox(rangeSlider, gd, axisOpts, opts) { + if(gd._context.staticPlot) return; + var slideBox = rangeSlider.selectAll('rect.' + constants.slideBoxClassName) .data([0]); @@ -483,6 +485,8 @@ function drawGrabbers(rangeSlider, gd, axisOpts, opts) { // + if(gd._context.staticPlot) return; + var grabAreaFixAttrs = { width: constants.grabAreaWidth, y: 0, From 09a807de42271ec91cc3b203cd80c04e38c3be4f Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?=C3=89tienne=20T=C3=A9treault-Pinard?= Date: Tue, 17 Jan 2017 10:49:35 -0500 Subject: [PATCH 4/4] add `range_slider_initial_valid` to image export test cases --- test/image/export_test.js | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-) diff --git a/test/image/export_test.js b/test/image/export_test.js index 9846c79348f..516178d851e 100644 --- a/test/image/export_test.js +++ b/test/image/export_test.js @@ -19,7 +19,8 @@ var FORMATS = ['svg', 'pdf', 'eps']; // non-exhaustive list of mocks to test var DEFAULT_LIST = [ - '0', 'geo_first', 'gl3d_z-range', 'text_export', 'layout_image', 'gl2d_12' + '0', 'geo_first', 'gl3d_z-range', 'text_export', 'layout_image', 'gl2d_12', + 'range_slider_initial_valid' ]; // return dimensions [in px]