Skip to content

Commit 56dd829

Browse files
authored
Merge pull request #4061 from plotly/showEditInChartStudio
Add showEditInChartStudio config option
2 parents 72f885a + d374ecc commit 56dd829

21 files changed

+65
-1717
lines changed

Diff for: .gitignore

-1
Original file line numberDiff line numberDiff line change
@@ -2,7 +2,6 @@ node_modules
22

33
build/*
44
!build/plotcss.js
5-
!build/ploticon.js
65
!build/README.md
76

87
npm-debug.log*

Diff for: .npmignore

-1
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,5 @@
11
build/*
22
!build/plotcss.js
3-
!build/ploticon.js
43
!build/README.md
54

65
devtools

Diff for: package-lock.json

-16
Some generated files are not rendered by default. Learn more about customizing how changed files appear on GitHub.

Diff for: package.json

+1-2
Original file line numberDiff line numberDiff line change
@@ -159,7 +159,6 @@
159159
"run-series": "^1.1.8",
160160
"through2": "^3.0.1",
161161
"true-case-path": "^1.0.3",
162-
"watchify": "^3.11.1",
163-
"xml2js": "^0.4.19"
162+
"watchify": "^3.11.1"
164163
}
165164
}

Diff for: src/components/modebar/buttons.js

+10-1
Original file line numberDiff line numberDiff line change
@@ -12,7 +12,7 @@ var Registry = require('../../registry');
1212
var Plots = require('../../plots/plots');
1313
var axisIds = require('../../plots/cartesian/axis_ids');
1414
var Lib = require('../../lib');
15-
var Icons = require('../../../build/ploticon');
15+
var Icons = require('../../fonts/ploticon');
1616

1717
var _ = Lib._;
1818

@@ -89,6 +89,15 @@ modeBarButtons.sendDataToCloud = {
8989
}
9090
};
9191

92+
modeBarButtons.editInChartStudio = {
93+
name: 'editInChartStudio',
94+
title: function(gd) { return _(gd, 'Edit in Chart Studio'); },
95+
icon: Icons.pencil,
96+
click: function(gd) {
97+
Plots.sendDataToCloud(gd);
98+
}
99+
};
100+
92101
modeBarButtons.zoom2d = {
93102
name: 'zoom2d',
94103
title: function(gd) { return _(gd, 'Zoom'); },

Diff for: src/components/modebar/manage.js

+7-8
Original file line numberDiff line numberDiff line change
@@ -59,22 +59,20 @@ module.exports = function manageModeBar(gd) {
5959
} else if(!context.displayModeBar && context.watermark) {
6060
buttonGroups = [];
6161
} else {
62-
buttonGroups = getButtonGroups(
63-
gd,
64-
context.modeBarButtonsToRemove,
65-
context.modeBarButtonsToAdd,
66-
context.showSendToCloud
67-
);
62+
buttonGroups = getButtonGroups(gd);
6863
}
6964

7065
if(modeBar) modeBar.update(gd, buttonGroups);
7166
else fullLayout._modeBar = createModeBar(gd, buttonGroups);
7267
};
7368

7469
// logic behind which buttons are displayed by default
75-
function getButtonGroups(gd, buttonsToRemove, buttonsToAdd, showSendToCloud) {
70+
function getButtonGroups(gd) {
7671
var fullLayout = gd._fullLayout;
7772
var fullData = gd._fullData;
73+
var context = gd._context;
74+
var buttonsToRemove = context.modeBarButtonsToRemove;
75+
var buttonsToAdd = context.modeBarButtonsToAdd;
7876

7977
var hasCartesian = fullLayout._has('cartesian');
8078
var hasGL3D = fullLayout._has('gl3d');
@@ -106,7 +104,8 @@ function getButtonGroups(gd, buttonsToRemove, buttonsToAdd, showSendToCloud) {
106104

107105
// buttons common to all plot types
108106
var commonGroup = ['toImage'];
109-
if(showSendToCloud) commonGroup.push('sendDataToCloud');
107+
if(context.showEditInChartStudio) commonGroup.push('editInChartStudio');
108+
else if(context.showSendToCloud) commonGroup.push('sendDataToCloud');
110109
addGroup(commonGroup);
111110

112111
var zoomGroup = [];

Diff for: src/components/modebar/modebar.js

+1-1
Original file line numberDiff line numberDiff line change
@@ -13,7 +13,7 @@ var d3 = require('d3');
1313
var isNumeric = require('fast-isnumeric');
1414

1515
var Lib = require('../../lib');
16-
var Icons = require('../../../build/ploticon');
16+
var Icons = require('../../fonts/ploticon');
1717
var Parser = new DOMParser();
1818

1919
/**

Diff for: src/core.js

+1-1
Original file line numberDiff line numberDiff line change
@@ -66,7 +66,7 @@ register([
6666
]);
6767

6868
// plot icons
69-
exports.Icons = require('../build/ploticon');
69+
exports.Icons = require('./fonts/ploticon');
7070

7171
// unofficial 'beta' plot methods, use at your own risk
7272
exports.Plots = require('./plots/plots');

Diff for: build/ploticon.js renamed to src/fonts/ploticon.js

+14
Original file line numberDiff line numberDiff line change
@@ -1,3 +1,11 @@
1+
/**
2+
* Copyright 2012-2019, Plotly, Inc.
3+
* All rights reserved.
4+
*
5+
* This source code is licensed under the MIT license found in the
6+
* LICENSE file in the root directory of this source tree.
7+
*/
8+
19
'use strict';
210

311
module.exports = {
@@ -121,6 +129,12 @@ module.exports = {
121129
'path': 'M512 409c0-57-46-104-103-104-57 0-104 47-104 104 0 57 47 103 104 103 57 0 103-46 103-103z m-327-39l92 0 0 92-92 0z m-185 0l92 0 0 92-92 0z m370-186l92 0 0 93-92 0z m0-184l92 0 0 92-92 0z',
122130
'transform': 'matrix(1.5 0 0 -1.5 0 850)'
123131
},
132+
'pencil': {
133+
'width': 1792,
134+
'height': 1792,
135+
'path': 'M491 1536l91-91-235-235-91 91v107h128v128h107zm523-928q0-22-22-22-10 0-17 7l-542 542q-7 7-7 17 0 22 22 22 10 0 17-7l542-542q7-7 7-17zm-54-192l416 416-832 832h-416v-416zm683 96q0 53-37 90l-166 166-416-416 166-165q36-38 90-38 53 0 91 38l235 234q37 39 37 91z',
136+
'transform': 'matrix(1 0 0 1 0 1)'
137+
},
124138
'newplotlylogo': {
125139
'name': 'newplotlylogo',
126140
'svg': '<svg xmlns=\'http://www.w3.org/2000/svg\' viewBox=\'0 0 132 132\'><defs><style>.cls-1 {fill: #119dff;} .cls-2 {fill: #25fefd;} .cls-3 {fill: #fff;}</style></defs><title>plotly-logomark</title><g id=\'symbol\'><rect class=\'cls-1\' width=\'132\' height=\'132\' rx=\'6\' ry=\'6\'/><circle class=\'cls-2\' cx=\'78\' cy=\'54\' r=\'6\'/><circle class=\'cls-2\' cx=\'102\' cy=\'30\' r=\'6\'/><circle class=\'cls-2\' cx=\'78\' cy=\'30\' r=\'6\'/><circle class=\'cls-2\' cx=\'54\' cy=\'30\' r=\'6\'/><circle class=\'cls-2\' cx=\'30\' cy=\'30\' r=\'6\'/><circle class=\'cls-2\' cx=\'30\' cy=\'54\' r=\'6\'/><path class=\'cls-3\' d=\'M30,72a6,6,0,0,0-6,6v24a6,6,0,0,0,12,0V78A6,6,0,0,0,30,72Z\'/><path class=\'cls-3\' d=\'M78,72a6,6,0,0,0-6,6v24a6,6,0,0,0,12,0V78A6,6,0,0,0,78,72Z\'/><path class=\'cls-3\' d=\'M54,48a6,6,0,0,0-6,6v48a6,6,0,0,0,12,0V54A6,6,0,0,0,54,48Z\'/><path class=\'cls-3\' d=\'M102,48a6,6,0,0,0-6,6v48a6,6,0,0,0,12,0V54A6,6,0,0,0,102,48Z\'/></g></svg>'

Diff for: src/fonts/ploticon/_ploticon.scss

-45
This file was deleted.

0 commit comments

Comments
 (0)