diff --git a/src/components/modebar/index.js b/src/components/modebar/index.js index 0396a1928af..3a81070e82c 100644 --- a/src/components/modebar/index.js +++ b/src/components/modebar/index.js @@ -478,6 +478,11 @@ proto.toImage = function() { }); }; +proto.sendDataToCloud = function() { + var gd = this.graphInfo; + Plotly.Plots.sendDataToCloud(gd) +}; + /** * * @Property config specification hash of button parameters @@ -547,6 +552,11 @@ proto.config = function config() { icon: 'camera', click: this.toImage }, + sendDataToCloud: { + title: 'save and edit plot in cloud', + icon: 'disk', + click: this.sendDataToCloud + }, // gl3d zoom3d: { title: 'Zoom', diff --git a/src/fonts/ploticon/_ploticon.scss b/src/fonts/ploticon/_ploticon.scss index bbc20ad4f7f..4eec878fe46 100644 --- a/src/fonts/ploticon/_ploticon.scss +++ b/src/fonts/ploticon/_ploticon.scss @@ -39,3 +39,4 @@ .ploticon-3d_rotate:before { content: '\e80c'; } /* '' */ .ploticon-camera:before { content: '\e80d'; } /* '' */ .ploticon-movie:before { content: '\e80e'; } /* '' */ +.ploticon-disk:before { content: '\e80f'; } /* '' */ diff --git a/src/fonts/ploticon/ploticon.eot b/src/fonts/ploticon/ploticon.eot index 7fd1121f1e2..40859354421 100644 Binary files a/src/fonts/ploticon/ploticon.eot and b/src/fonts/ploticon/ploticon.eot differ diff --git a/src/fonts/ploticon/ploticon.svg b/src/fonts/ploticon/ploticon.svg index c28cc27e6f4..b62d425e1fb 100644 --- a/src/fonts/ploticon/ploticon.svg +++ b/src/fonts/ploticon/ploticon.svg @@ -3,8 +3,8 @@ Copyright (C) 2015 by original authors @ fontello.com - - + + @@ -21,6 +21,7 @@ + - \ No newline at end of file + diff --git a/src/fonts/ploticon/ploticon.ttf b/src/fonts/ploticon/ploticon.ttf index f5212c625fa..261232058d7 100644 Binary files a/src/fonts/ploticon/ploticon.ttf and b/src/fonts/ploticon/ploticon.ttf differ diff --git a/src/fonts/ploticon/ploticon.woff b/src/fonts/ploticon/ploticon.woff index 4aa0d332f67..c4d7225d903 100644 Binary files a/src/fonts/ploticon/ploticon.woff and b/src/fonts/ploticon/ploticon.woff differ diff --git a/src/plot_api/plot_config.js b/src/plot_api/plot_config.js index a5820ec0a78..6e01bdff4d8 100644 --- a/src/plot_api/plot_config.js +++ b/src/plot_api/plot_config.js @@ -35,7 +35,7 @@ module.exports = { showTips: true, // link to open this plot in plotly - showLink: true, + showLink: false, // if we show a link, does it contain data or just link to a plotly file? sendData: true, diff --git a/src/plots/cartesian/graph_interact.js b/src/plots/cartesian/graph_interact.js index ce068313722..11751022085 100644 --- a/src/plots/cartesian/graph_interact.js +++ b/src/plots/cartesian/graph_interact.js @@ -1319,7 +1319,7 @@ fx.modeBar = function(gd){ function chooseModebarButtons(fullLayout) { if(fullLayout._hasGL3D) { return [ - ['toImage'], + ['toImage', 'sendDataToCloud'], ['orbitRotation', 'tableRotation', 'zoom3d', 'pan3d'], ['resetCameraDefault3d', 'resetCameraLastSave3d'], ['hoverClosest3d'] @@ -1327,7 +1327,7 @@ function chooseModebarButtons(fullLayout) { } else if(fullLayout._hasGeo) { return [ - ['toImage'], + ['toImage', 'sendDataToCloud'], ['zoomInGeo', 'zoomOutGeo', 'resetGeo'], ['hoverClosestGeo'] ]; @@ -1345,9 +1345,9 @@ function chooseModebarButtons(fullLayout) { } } - if(allFixed) buttons = [['toImage']]; + if(allFixed) buttons = [['toImage', 'sendDataToCloud']]; else buttons = [ - ['toImage'], + ['toImage', 'sendDataToCloud'], ['zoom2d', 'pan2d'], ['zoomIn2d', 'zoomOut2d', 'resetScale2d', 'autoScale2d'] ]; diff --git a/src/plots/plots.js b/src/plots/plots.js index e61d1778436..fb4fddfd3d0 100644 --- a/src/plots/plots.js +++ b/src/plots/plots.js @@ -342,37 +342,8 @@ function positionPlayWithData(gd, container){ .text(gd._context.linkText + ' ' + String.fromCharCode(187)); if(gd._context.sendData) { - link.on('click',function(){ - gd.emit('plotly_beforeexport'); - - var baseUrl = (window.PLOTLYENV && window.PLOTLYENV.BASE_URL) || 'https://plot.ly'; - - var hiddenformDiv = d3.select(gd) - .append('div') - .attr('id', 'hiddenform') - .style('display', 'none'); - - var hiddenform = hiddenformDiv - .append('form') - .attr({ - action: baseUrl + '/external', - method: 'post', - target: '_blank' - }); - - var hiddenformInput = hiddenform - .append('input') - .attr({ - type: 'text', - name: 'data' - }); - - hiddenformInput.node().value = plots.graphJson(gd, false, 'keepdata'); - hiddenform.node().submit(); - hiddenformDiv.remove(); - - gd.emit('plotly_afterexport'); - return false; + link.on('click', function() { + plots.sendDataToCloud(gd) }); } else { @@ -384,6 +355,38 @@ function positionPlayWithData(gd, container){ }); } } +plots.sendDataToCloud = function(gd) { + gd.emit('plotly_beforeexport'); + + var baseUrl = (window.PLOTLYENV && window.PLOTLYENV.BASE_URL) || 'https://plot.ly'; + + var hiddenformDiv = d3.select(gd) + .append('div') + .attr('id', 'hiddenform') + .style('display', 'none'); + + var hiddenform = hiddenformDiv + .append('form') + .attr({ + action: baseUrl + '/external', + method: 'post', + target: '_blank' + }); + + var hiddenformInput = hiddenform + .append('input') + .attr({ + type: 'text', + name: 'data' + }); + + hiddenformInput.node().value = plots.graphJson(gd, false, 'keepdata'); + hiddenform.node().submit(); + hiddenformDiv.remove(); + + gd.emit('plotly_afterexport'); + return false; +} plots.supplyDefaults = function(gd) { // fill in default values: