Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
10 changes: 10 additions & 0 deletions src/components/modebar/index.js
Original file line number Diff line number Diff line change
Expand Up @@ -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
Expand Down Expand Up @@ -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',
Expand Down
1 change: 1 addition & 0 deletions src/fonts/ploticon/_ploticon.scss
Original file line number Diff line number Diff line change
Expand Up @@ -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'; } /* '' */
Binary file modified src/fonts/ploticon/ploticon.eot
Binary file not shown.
7 changes: 4 additions & 3 deletions src/fonts/ploticon/ploticon.svg
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Binary file modified src/fonts/ploticon/ploticon.ttf
Binary file not shown.
Binary file modified src/fonts/ploticon/ploticon.woff
Binary file not shown.
2 changes: 1 addition & 1 deletion src/plot_api/plot_config.js
Original file line number Diff line number Diff line change
Expand Up @@ -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,
Expand Down
8 changes: 4 additions & 4 deletions src/plots/cartesian/graph_interact.js
Original file line number Diff line number Diff line change
Expand Up @@ -1319,15 +1319,15 @@ fx.modeBar = function(gd){
function chooseModebarButtons(fullLayout) {
if(fullLayout._hasGL3D) {
return [
['toImage'],
['toImage', 'sendDataToCloud'],
['orbitRotation', 'tableRotation', 'zoom3d', 'pan3d'],
['resetCameraDefault3d', 'resetCameraLastSave3d'],
['hoverClosest3d']
];
}
else if(fullLayout._hasGeo) {
return [
['toImage'],
['toImage', 'sendDataToCloud'],
['zoomInGeo', 'zoomOutGeo', 'resetGeo'],
['hoverClosestGeo']
];
Expand All @@ -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']
];
Expand Down
65 changes: 34 additions & 31 deletions src/plots/plots.js
Original file line number Diff line number Diff line change
Expand Up @@ -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 {
Expand All @@ -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:
Expand Down