Skip to content

Commit 117a8c2

Browse files
committed
Remove chart studio upload APIs
1 parent 1dc8553 commit 117a8c2

8 files changed

Lines changed: 2 additions & 1151 deletions

File tree

src/plot_api/plot_api.js

Lines changed: 0 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -373,7 +373,6 @@ function _doPlot(gd, data, layout, config) {
373373
subroutines.drawData,
374374
subroutines.finalDraw,
375375
initInteractions,
376-
Plots.addLinks,
377376
Plots.rehover,
378377
Plots.redrag,
379378
Plots.reselect,
@@ -485,7 +484,6 @@ function setPlotContext(gd, config) {
485484
context.scrollZoom = false;
486485
context.doubleClick = false;
487486
context.showTips = false;
488-
context.showLink = false;
489487
context.displayModeBar = false;
490488
}
491489

src/plot_api/plot_config.js

Lines changed: 1 addition & 36 deletions
Original file line numberDiff line numberDiff line change
@@ -36,8 +36,7 @@ var configAttributes = {
3636
dflt: '',
3737
description: [
3838
'When set it determines base URL for',
39-
'the \'Edit in Chart Studio\' `showEditInChartStudio`/`showSendToCloud` mode bar button',
40-
'and the showLink/sendData on-graph link.',
39+
'the \'Edit in Chart Studio\' `showEditInChartStudio`/`showSendToCloud` mode bar button.',
4140
'To enable sending your data to Chart Studio Cloud, you need to',
4241
'set both `plotlyServerURL` to \'https://chart-studio.plotly.com\' and',
4342
'also set `showSendToCloud` to true.'
@@ -227,40 +226,6 @@ var configAttributes = {
227226
description: 'Determines whether or not notifier is displayed.'
228227
},
229228

230-
showLink: {
231-
valType: 'boolean',
232-
dflt: false,
233-
description: [
234-
'Determines whether a link to Chart Studio Cloud is displayed',
235-
'at the bottom right corner of resulting graphs.',
236-
'Use with `sendData` and `linkText`.'
237-
].join(' ')
238-
},
239-
linkText: {
240-
valType: 'string',
241-
dflt: 'Edit chart',
242-
noBlank: true,
243-
description: [
244-
'Sets the text appearing in the `showLink` link.'
245-
].join(' ')
246-
},
247-
sendData: {
248-
valType: 'boolean',
249-
dflt: true,
250-
description: [
251-
'If *showLink* is true, does it contain data',
252-
'just link to a Chart Studio Cloud file?'
253-
].join(' ')
254-
},
255-
showSources: {
256-
valType: 'any',
257-
dflt: false,
258-
description: [
259-
'Adds a source-displaying function to show sources on',
260-
'the resulting graphs.'
261-
].join(' ')
262-
},
263-
264229
displayModeBar: {
265230
valType: 'enumerated',
266231
values: ['hover', true, false],

src/plots/attributes.js

Lines changed: 0 additions & 26 deletions
Original file line numberDiff line numberDiff line change
@@ -188,32 +188,6 @@ module.exports = {
188188
].join(' ')
189189
},
190190
hoverlabel: fxAttrs.hoverlabel,
191-
stream: {
192-
token: {
193-
valType: 'string',
194-
noBlank: true,
195-
strict: true,
196-
editType: 'calc',
197-
description: [
198-
'The stream id number links a data trace on a plot with a stream.',
199-
'See https://chart-studio.plotly.com/settings for more details.'
200-
].join(' ')
201-
},
202-
maxpoints: {
203-
valType: 'number',
204-
min: 0,
205-
max: 10000,
206-
dflt: 500,
207-
editType: 'calc',
208-
description: [
209-
'Sets the maximum number of points to keep on the plots from an',
210-
'incoming stream.',
211-
'If `maxpoints` is set to *50*, only the newest 50 points will',
212-
'be displayed on the plot.'
213-
].join(' ')
214-
},
215-
editType: 'calc'
216-
},
217191
uirevision: {
218192
valType: 'any',
219193
editType: 'none',

src/plots/plots.js

Lines changed: 0 additions & 97 deletions
Original file line numberDiff line numberDiff line change
@@ -113,93 +113,6 @@ plots.previousPromises = function(gd) {
113113
}
114114
};
115115

116-
/**
117-
* Adds the 'Edit chart' link.
118-
* Note that now _doPlot calls this so it can regenerate whenever it replots
119-
*
120-
* Add source links to your graph inside the 'showSources' config argument.
121-
*/
122-
plots.addLinks = function(gd) {
123-
// Do not do anything if showLink and showSources are not set to true in config
124-
if(!gd._context.showLink && !gd._context.showSources) return;
125-
126-
var fullLayout = gd._fullLayout;
127-
128-
var linkContainer = Lib.ensureSingle(fullLayout._paper, 'text', 'js-plot-link-container', function(s) {
129-
s.style({
130-
'font-family': '"Open Sans", Arial, sans-serif',
131-
'font-size': '12px',
132-
fill: Color.defaultLine,
133-
'pointer-events': 'all'
134-
})
135-
.each(function() {
136-
var links = d3.select(this);
137-
links.append('tspan').classed('js-link-to-tool', true);
138-
links.append('tspan').classed('js-link-spacer', true);
139-
links.append('tspan').classed('js-sourcelinks', true);
140-
});
141-
});
142-
143-
// The text node inside svg
144-
var text = linkContainer.node();
145-
var attrs = {y: fullLayout._paper.attr('height') - 9};
146-
147-
// If text's width is bigger than the layout
148-
// Check that text is a child node or document.body
149-
// because otherwise Edge might throw an exception
150-
// when calling getComputedTextLength().
151-
// Apparently offsetParent is null for invisibles.
152-
if(document.body.contains(text) && text.getComputedTextLength() >= (fullLayout.width - 20)) {
153-
// Align the text at the left
154-
attrs['text-anchor'] = 'start';
155-
attrs.x = 5;
156-
} else {
157-
// Align the text at the right
158-
attrs['text-anchor'] = 'end';
159-
attrs.x = fullLayout._paper.attr('width') - 7;
160-
}
161-
162-
linkContainer.attr(attrs);
163-
164-
var toolspan = linkContainer.select('.js-link-to-tool');
165-
var spacespan = linkContainer.select('.js-link-spacer');
166-
var sourcespan = linkContainer.select('.js-sourcelinks');
167-
168-
if(gd._context.showSources) gd._context.showSources(gd);
169-
170-
// 'view in plotly' link for embedded plots
171-
if(gd._context.showLink) positionPlayWithData(gd, toolspan);
172-
173-
// separator if we have both sources and tool link
174-
spacespan.text((toolspan.text() && sourcespan.text()) ? ' - ' : '');
175-
};
176-
177-
// note that now this function is only adding the brand in
178-
// iframes and 3rd-party apps
179-
function positionPlayWithData(gd, container) {
180-
container.text('');
181-
var link = container.append('a')
182-
.attr({
183-
'xlink:xlink:href': '#',
184-
class: 'link--impt link--embedview',
185-
'font-weight': 'bold'
186-
})
187-
.text(gd._context.linkText + ' ' + String.fromCharCode(187));
188-
189-
if(gd._context.sendData) {
190-
link.on('click', function() {
191-
plots.sendDataToCloud(gd);
192-
});
193-
} else {
194-
var path = window.location.pathname.split('/');
195-
var query = window.location.search;
196-
link.attr({
197-
'xlink:xlink:show': 'new',
198-
'xlink:xlink:href': '/' + path[2].split('.')[0] + '/' + path[1] + query
199-
});
200-
}
201-
}
202-
203116
plots.sendDataToCloud = function(gd) {
204117
var baseUrl = (window.PLOTLYENV || {}).BASE_URL || gd._context.plotlyServerURL;
205118
if(!baseUrl) return;
@@ -2106,16 +2019,6 @@ plots.graphJson = function(gd, dataonly, mode, output, useDefaults, includeConfi
21062019
if(v.slice(-3) === 'src') {
21072020
return;
21082021
}
2109-
} else if(mode === 'keepstream') {
2110-
// keep sourced data if it's being streamed.
2111-
// similar to keepref, but if the 'stream' object exists
2112-
// in a trace, we will keep the data array.
2113-
src = d[v + 'src'];
2114-
if(typeof src === 'string' && src.indexOf(':') > 0) {
2115-
if(!Lib.isPlainObject(d.stream)) {
2116-
return;
2117-
}
2118-
}
21192022
} else if(mode !== 'keepall') {
21202023
// keepref: remove sourced data but only
21212024
// if the source tag is well-formed

src/snapshot/cloneplot.js

Lines changed: 0 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -141,7 +141,6 @@ module.exports = function clonePlot(graphObj, options) {
141141
2 :
142142
options.plotGlPixelRatio,
143143
displaylogo: options.displaylogo || false,
144-
showLink: options.showLink || false,
145144
showTips: options.showTips || false,
146145
mapboxAccessToken: context.mapboxAccessToken
147146
}

test/jasmine/tests/config_test.js

Lines changed: 0 additions & 35 deletions
Original file line numberDiff line numberDiff line change
@@ -219,41 +219,6 @@ describe('config argument', function() {
219219
});
220220
});
221221

222-
describe('showLink attribute', function() {
223-
var gd;
224-
225-
beforeEach(function() {
226-
gd = createGraphDiv();
227-
});
228-
229-
afterEach(destroyGraphDiv);
230-
231-
it('should not display the edit link by default', function(done) {
232-
Plotly.newPlot(gd, [], {})
233-
.then(function() {
234-
var link = document.getElementsByClassName('js-plot-link-container')[0];
235-
236-
expect(link).toBeUndefined();
237-
})
238-
.then(done, done.fail);
239-
});
240-
241-
it('should display a link when true', function(done) {
242-
Plotly.newPlot(gd, [], {}, { showLink: true })
243-
.then(function() {
244-
var link = document.getElementsByClassName('js-plot-link-container')[0];
245-
246-
expect(link.textContent).toBe('Edit chart »');
247-
248-
var bBox = link.getBoundingClientRect();
249-
expect(bBox.width).toBeGreaterThan(0);
250-
expect(bBox.height).toBeGreaterThan(0);
251-
})
252-
.then(done, done.fail);
253-
});
254-
});
255-
256-
257222
describe('editable attribute', function() {
258223
var gd;
259224

test/jasmine/tests/snapshot_test.js

Lines changed: 0 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -80,7 +80,6 @@ describe('Plotly.Snapshot', function() {
8080
staticPlot: true,
8181
plotGlPixelRatio: 2,
8282
displaylogo: false,
83-
showLink: false,
8483
showTips: false,
8584
setBackground: 'opaque',
8685
mapboxAccessToken: undefined

0 commit comments

Comments
 (0)