diff --git a/src/plot_api/plot_config.js b/src/plot_api/plot_config.js index 87c3d8e4ad7..403b748cf84 100644 --- a/src/plot_api/plot_config.js +++ b/src/plot_api/plot_config.js @@ -32,10 +32,14 @@ var configAttributes = { plotlyServerURL: { valType: 'string', - dflt: 'https://plot.ly', + dflt: '', description: [ - 'Sets base URL for the \'Edit in Chart Studio\' (aka sendDataToCloud) mode bar button', - 'and the showLink/sendData on-graph link' + 'When set it determines base URL for', + 'the \'Edit in Chart Studio\' `showEditInChartStudio`/`showSendToCloud` mode bar button', + 'and the showLink/sendData on-graph link.', + 'To enable sending your data to Chart Studio Cloud, you need to', + 'set both `plotlyServerURL` to \'https://chart-studio.plotly.com\' and', + 'also set `showSendToCloud` to true.' ].join(' ') }, @@ -261,10 +265,10 @@ var configAttributes = { dflt: false, description: [ 'Should we include a ModeBar button, labeled "Edit in Chart Studio",', - 'that sends this chart to plot.ly or another plotly server as specified', - 'by `plotlyServerURL` for editing, export, etc? Prior to version 1.43.0', + 'that sends this chart to chart-studio.plotly.com (formerly plot.ly) or another plotly server', + 'as specified by `plotlyServerURL` for editing, export, etc? Prior to version 1.43.0', 'this button was included by default, now it is opt-in using this flag.', - 'Note that this button can (depending on `plotlyServerURL`) send your data', + 'Note that this button can (depending on `plotlyServerURL` being set) send your data', 'to an external server. However that server does not persist your data', 'until you arrive at the Chart Studio and explicitly click "Save".' ].join(' ') diff --git a/src/plots/plots.js b/src/plots/plots.js index 85d32db040a..5d24930ac58 100644 --- a/src/plots/plots.js +++ b/src/plots/plots.js @@ -215,9 +215,10 @@ function positionPlayWithData(gd, container) { } plots.sendDataToCloud = function(gd) { - gd.emit('plotly_beforeexport'); - var baseUrl = (window.PLOTLYENV || {}).BASE_URL || gd._context.plotlyServerURL; + if(!baseUrl) return; + + gd.emit('plotly_beforeexport'); var hiddenformDiv = d3.select(gd) .append('div') diff --git a/test/jasmine/tests/config_test.js b/test/jasmine/tests/config_test.js index 25084472885..48f6b818f74 100644 --- a/test/jasmine/tests/config_test.js +++ b/test/jasmine/tests/config_test.js @@ -501,13 +501,29 @@ describe('config argument', function() { afterEach(destroyGraphDiv); - it('should default to plotly cloud', function(done) { + it('should not default to an external plotly cloud', function(done) { Plotly.plot(gd, [], {}) .then(function() { - expect(gd._context.plotlyServerURL).toBe('https://plot.ly'); + expect(gd._context.plotlyServerURL).not.toBe('https://plot.ly'); + expect(gd._context.plotlyServerURL).not.toBe('https://chart-studio.plotly.com'); + expect(gd._context.plotlyServerURL).toBe(''); Plotly.Plots.sendDataToCloud(gd); - expect(form.action).toBe('https://plot.ly/external'); + expect(form).toBe(undefined); + }) + .catch(failTest) + .then(done); + }); + + it('should be able to connect to Chart Studio Cloud when set to https://chart-studio.plotly.com', function(done) { + Plotly.plot(gd, [], {}, { + plotlyServerURL: 'https://chart-studio.plotly.com' + }) + .then(function() { + expect(gd._context.plotlyServerURL).toBe('https://chart-studio.plotly.com'); + + Plotly.Plots.sendDataToCloud(gd); + expect(form.action).toBe('https://chart-studio.plotly.com/external'); expect(form.method).toBe('post'); }) .catch(failTest)