plotly.js 1.58.3 → 1.58.4
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/CHANGELOG.md +8 -0
- package/dist/README.md +25 -25
- package/dist/plot-schema.json +13 -13
- package/dist/plotly-basic.js +434 -326
- package/dist/plotly-basic.min.js +4 -4
- package/dist/plotly-cartesian.js +551 -443
- package/dist/plotly-cartesian.min.js +4 -4
- package/dist/plotly-finance.js +515 -407
- package/dist/plotly-finance.min.js +4 -4
- package/dist/plotly-geo-assets.js +2 -2
- package/dist/plotly-geo.js +438 -330
- package/dist/plotly-geo.min.js +4 -4
- package/dist/plotly-gl2d.js +616 -508
- package/dist/plotly-gl2d.min.js +10 -10
- package/dist/plotly-gl3d.js +340 -271
- package/dist/plotly-gl3d.min.js +3 -3
- package/dist/plotly-mapbox.js +448 -340
- package/dist/plotly-mapbox.min.js +4 -4
- package/dist/plotly-with-meta.js +805 -736
- package/dist/plotly.js +801 -732
- package/dist/plotly.min.js +3 -3
- package/package.json +1 -1
- package/src/components/colorscale/index.js +1 -1
- package/src/components/errorbars/attributes.js +1 -1
- package/src/components/fx/hover.js +1 -1
- package/src/components/sliders/draw.js +1 -1
- package/src/lib/index.js +2 -1
- package/src/lib/preserve_drawing_buffer.js +68 -0
- package/src/plot_api/plot_api.js +1 -1
- package/src/plots/gl3d/scene.js +16 -18
- package/src/traces/carpet/attributes.js +2 -2
- package/src/traces/carpet/create_i_derivative_evaluator.js +1 -1
- package/src/traces/carpet/plot.js +1 -1
- package/src/traces/carpet/set_convert.js +2 -2
- package/src/traces/carpet/smooth_fill_2d_array.js +1 -1
- package/src/traces/parcats/attributes.js +1 -1
- package/src/traces/scatter/plot.js +1 -1
- package/src/traces/scattercarpet/plot.js +1 -1
- package/src/version.js +1 -1
package/package.json
CHANGED
|
@@ -25,7 +25,7 @@ module.exports = {
|
|
|
25
25
|
calc: require('./calc'),
|
|
26
26
|
|
|
27
27
|
// ./scales.js is required in lib/coerce.js ;
|
|
28
|
-
// it needs to be a
|
|
28
|
+
// it needs to be a separate module to avoid circular a dependency
|
|
29
29
|
scales: scales.scales,
|
|
30
30
|
defaultScale: scales.defaultScale,
|
|
31
31
|
getScale: scales.get,
|
|
@@ -32,7 +32,7 @@ module.exports = {
|
|
|
32
32
|
'If *percent*, the bar lengths correspond to a percentage of',
|
|
33
33
|
'underlying data. Set this percentage in `value`.',
|
|
34
34
|
|
|
35
|
-
'If *sqrt*, the bar lengths correspond to the
|
|
35
|
+
'If *sqrt*, the bar lengths correspond to the square of the',
|
|
36
36
|
'underlying data.',
|
|
37
37
|
|
|
38
38
|
'If *data*, the bar lengths are set with data set `array`.'
|
|
@@ -1306,7 +1306,7 @@ function getHoverLabelText(d, showCommonLabel, hovermode, fullLayout, t0, g) {
|
|
|
1306
1306
|
|
|
1307
1307
|
// Make groups of touching points, and within each group
|
|
1308
1308
|
// move each point so that no labels overlap, but the average
|
|
1309
|
-
// label position is the same as it was before moving.
|
|
1309
|
+
// label position is the same as it was before moving. Incidentally,
|
|
1310
1310
|
// this is equivalent to saying all the labels are on equal linear
|
|
1311
1311
|
// springs about their initial position. Initially, each point is
|
|
1312
1312
|
// its own group, but as we find overlaps we will clump the points.
|
|
@@ -571,7 +571,7 @@ function setGripPosition(sliderGroup, sliderOpts, doTransition) {
|
|
|
571
571
|
.ease(sliderOpts.transition.easing);
|
|
572
572
|
}
|
|
573
573
|
|
|
574
|
-
// Drawing.setTranslate doesn't work here
|
|
574
|
+
// Drawing.setTranslate doesn't work here because of the transition duck-typing.
|
|
575
575
|
// It's also not necessary because there are no other transitions to preserve.
|
|
576
576
|
el.attr('transform', strTranslate(x - constants.gripWidth * 0.5, sliderOpts._dims.currentValueTotalHeight));
|
|
577
577
|
}
|
package/src/lib/index.js
CHANGED
|
@@ -154,6 +154,7 @@ lib.getElementAndAncestors = domModule.getElementAndAncestors;
|
|
|
154
154
|
lib.equalDomRects = domModule.equalDomRects;
|
|
155
155
|
|
|
156
156
|
lib.clearResponsive = require('./clear_responsive');
|
|
157
|
+
lib.preserveDrawingBuffer = require('./preserve_drawing_buffer');
|
|
157
158
|
|
|
158
159
|
lib.makeTraceGroups = require('./make_trace_groups');
|
|
159
160
|
|
|
@@ -864,7 +865,7 @@ lib.objectFromPath = function(path, value) {
|
|
|
864
865
|
* lib.expandObjectPaths({'foo[1].bar': 10, 'foo[0].bar': 20});
|
|
865
866
|
* => { foo: [{bar: 10}, {bar: 20}] }
|
|
866
867
|
*
|
|
867
|
-
* It does NOT, however, merge
|
|
868
|
+
* It does NOT, however, merge multiple multiply-nested arrays::
|
|
868
869
|
*
|
|
869
870
|
* lib.expandObjectPaths({'marker[1].range[1]': 5, 'marker[1].range[0]': 4})
|
|
870
871
|
* => { marker: [null, {range: 4}] }
|
|
@@ -0,0 +1,68 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* Copyright 2012-2020, 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
|
+
|
|
9
|
+
'use strict';
|
|
10
|
+
|
|
11
|
+
var isNumeric = require('fast-isnumeric');
|
|
12
|
+
var isMobileOrTablet = require('is-mobile');
|
|
13
|
+
|
|
14
|
+
module.exports = function preserveDrawingBuffer(opts) {
|
|
15
|
+
var ua;
|
|
16
|
+
|
|
17
|
+
if(opts && opts.hasOwnProperty('userAgent')) {
|
|
18
|
+
ua = opts.userAgent;
|
|
19
|
+
} else {
|
|
20
|
+
ua = getUserAgent();
|
|
21
|
+
}
|
|
22
|
+
|
|
23
|
+
if(typeof ua !== 'string') return true;
|
|
24
|
+
|
|
25
|
+
var enable = isMobileOrTablet({
|
|
26
|
+
ua: { headers: {'user-agent': ua }},
|
|
27
|
+
tablet: true,
|
|
28
|
+
featureDetect: false
|
|
29
|
+
});
|
|
30
|
+
|
|
31
|
+
if(!enable) {
|
|
32
|
+
var allParts = ua.split(' ');
|
|
33
|
+
for(var i = 1; i < allParts.length; i++) {
|
|
34
|
+
var part = allParts[i];
|
|
35
|
+
if(part.indexOf('Safari') !== -1) {
|
|
36
|
+
// find Safari version
|
|
37
|
+
for(var k = i - 1; k > -1; k--) {
|
|
38
|
+
var prevPart = allParts[k];
|
|
39
|
+
if(prevPart.substr(0, 8) === 'Version/') {
|
|
40
|
+
var v = prevPart.substr(8).split('.')[0];
|
|
41
|
+
if(isNumeric(v)) v = +v;
|
|
42
|
+
if(v >= 13) return true;
|
|
43
|
+
}
|
|
44
|
+
}
|
|
45
|
+
}
|
|
46
|
+
}
|
|
47
|
+
}
|
|
48
|
+
|
|
49
|
+
return enable;
|
|
50
|
+
};
|
|
51
|
+
|
|
52
|
+
function getUserAgent() {
|
|
53
|
+
// similar to https://github.com/juliangruber/is-mobile/blob/91ca39ccdd4cfc5edfb5391e2515b923a730fbea/index.js#L14-L17
|
|
54
|
+
var ua;
|
|
55
|
+
if(typeof navigator !== 'undefined') {
|
|
56
|
+
ua = navigator.userAgent;
|
|
57
|
+
}
|
|
58
|
+
|
|
59
|
+
if(
|
|
60
|
+
ua &&
|
|
61
|
+
ua.headers &&
|
|
62
|
+
typeof ua.headers['user-agent'] === 'string'
|
|
63
|
+
) {
|
|
64
|
+
ua = ua.headers['user-agent'];
|
|
65
|
+
}
|
|
66
|
+
|
|
67
|
+
return ua;
|
|
68
|
+
}
|
package/src/plot_api/plot_api.js
CHANGED
|
@@ -3231,7 +3231,7 @@ function animate(gd, frameOrGroupNameOrFrameList, animationOpts) {
|
|
|
3231
3231
|
}
|
|
3232
3232
|
|
|
3233
3233
|
// Execute a callback after the wrapper function has been called n times.
|
|
3234
|
-
// This is used to defer the resolution until a transition has
|
|
3234
|
+
// This is used to defer the resolution until a transition has resolved *and*
|
|
3235
3235
|
// the frame has completed. If it's not done this way, then we get a race
|
|
3236
3236
|
// condition in which the animation might resolve before a transition is complete
|
|
3237
3237
|
// or vice versa.
|
package/src/plots/gl3d/scene.js
CHANGED
|
@@ -18,6 +18,7 @@ var passiveSupported = require('has-passive-events');
|
|
|
18
18
|
|
|
19
19
|
var Registry = require('../../registry');
|
|
20
20
|
var Lib = require('../../lib');
|
|
21
|
+
var preserveDrawingBuffer = Lib.preserveDrawingBuffer();
|
|
21
22
|
|
|
22
23
|
var Axes = require('../../plots/cartesian/axes');
|
|
23
24
|
var Fx = require('../../components/fx');
|
|
@@ -30,9 +31,6 @@ var createAxesOptions = require('./layout/convert');
|
|
|
30
31
|
var createSpikeOptions = require('./layout/spikes');
|
|
31
32
|
var computeTickMarks = require('./layout/tick_marks');
|
|
32
33
|
|
|
33
|
-
var isMobile = require('is-mobile')({ tablet: true, featureDetect: true });
|
|
34
|
-
|
|
35
|
-
|
|
36
34
|
var STATIC_CANVAS, STATIC_CONTEXT;
|
|
37
35
|
|
|
38
36
|
function Scene(options, fullLayout) {
|
|
@@ -98,7 +96,7 @@ proto.prepareOptions = function() {
|
|
|
98
96
|
canvas: scene.canvas,
|
|
99
97
|
gl: scene.gl,
|
|
100
98
|
glOptions: {
|
|
101
|
-
preserveDrawingBuffer:
|
|
99
|
+
preserveDrawingBuffer: preserveDrawingBuffer,
|
|
102
100
|
premultipliedAlpha: true,
|
|
103
101
|
antialias: true
|
|
104
102
|
},
|
|
@@ -148,26 +146,26 @@ proto.tryCreatePlot = function() {
|
|
|
148
146
|
try {
|
|
149
147
|
scene.glplot = createPlot(opts);
|
|
150
148
|
} catch(e) {
|
|
151
|
-
if(scene.staticMode || !firstInit) {
|
|
149
|
+
if(scene.staticMode || !firstInit || preserveDrawingBuffer) {
|
|
152
150
|
success = false;
|
|
153
151
|
} else { // try second time
|
|
152
|
+
// enable preserveDrawingBuffer setup
|
|
153
|
+
// in case is-mobile not detecting the right device
|
|
154
|
+
Lib.warn([
|
|
155
|
+
'webgl setup failed possibly due to',
|
|
156
|
+
'false preserveDrawingBuffer config.',
|
|
157
|
+
'The mobile/tablet device may not be detected by is-mobile module.',
|
|
158
|
+
'Enabling preserveDrawingBuffer in second attempt to create webgl scene...'
|
|
159
|
+
].join(' '));
|
|
160
|
+
|
|
154
161
|
try {
|
|
155
|
-
// invert preserveDrawingBuffer
|
|
156
|
-
|
|
157
|
-
'webgl setup failed possibly due to',
|
|
158
|
-
isMobile ? 'disabling' : 'enabling',
|
|
159
|
-
'preserveDrawingBuffer config.',
|
|
160
|
-
'The device may not be supported by is-mobile module!',
|
|
161
|
-
'Inverting preserveDrawingBuffer option in second attempt to create webgl scene.'
|
|
162
|
-
].join(' '));
|
|
163
|
-
|
|
164
|
-
// invert is-mobile
|
|
165
|
-
isMobile = opts.glOptions.preserveDrawingBuffer = !opts.glOptions.preserveDrawingBuffer;
|
|
162
|
+
// invert preserveDrawingBuffer
|
|
163
|
+
preserveDrawingBuffer = opts.glOptions.preserveDrawingBuffer = true;
|
|
166
164
|
|
|
167
165
|
scene.glplot = createPlot(opts);
|
|
168
166
|
} catch(e) {
|
|
169
|
-
// revert changes to
|
|
170
|
-
|
|
167
|
+
// revert changes to preserveDrawingBuffer
|
|
168
|
+
preserveDrawingBuffer = opts.glOptions.preserveDrawingBuffer = false;
|
|
171
169
|
|
|
172
170
|
success = false;
|
|
173
171
|
}
|
|
@@ -37,7 +37,7 @@ module.exports = {
|
|
|
37
37
|
editType: 'calc+clearAxisTypes',
|
|
38
38
|
description: [
|
|
39
39
|
'A two dimensional array of x coordinates at each carpet point.',
|
|
40
|
-
'If
|
|
40
|
+
'If omitted, the plot is a cheater plot and the xaxis is hidden',
|
|
41
41
|
'by default.'
|
|
42
42
|
].join(' ')
|
|
43
43
|
},
|
|
@@ -109,7 +109,7 @@ module.exports = {
|
|
|
109
109
|
editType: 'calc',
|
|
110
110
|
description: [
|
|
111
111
|
'The shift applied to each successive row of data in creating a cheater plot.',
|
|
112
|
-
'Only used if `x` is been
|
|
112
|
+
'Only used if `x` is been omitted.'
|
|
113
113
|
].join(' ')
|
|
114
114
|
},
|
|
115
115
|
aaxis: axisAttrs,
|
|
@@ -19,7 +19,7 @@
|
|
|
19
19
|
* Also note that the discontinuity of the derivative is in magnitude only. The direction *is*
|
|
20
20
|
* continuous across cell boundaries.
|
|
21
21
|
*
|
|
22
|
-
* For example, to compute the derivative of the xcoordinate halfway
|
|
22
|
+
* For example, to compute the derivative of the xcoordinate halfway between the 7 and 8th i-gridpoints
|
|
23
23
|
* and the 10th and 11th j-gridpoints given bicubic smoothing in both dimensions, you'd write:
|
|
24
24
|
*
|
|
25
25
|
* var deriv = createIDerivativeEvaluator([x], 1, 1);
|
|
@@ -45,7 +45,7 @@ module.exports = function plot(gd, plotinfo, cdcarpet, carpetLayer) {
|
|
|
45
45
|
drawGridLines(xa, ya, minorLayer, aax, 'a', aax._minorgridlines, true);
|
|
46
46
|
drawGridLines(xa, ya, minorLayer, bax, 'b', bax._minorgridlines, true);
|
|
47
47
|
|
|
48
|
-
// NB: These are not
|
|
48
|
+
// NB: These are not omitted if the lines are not active. The joins must be executed
|
|
49
49
|
// in order for them to get cleaned up without a full redraw
|
|
50
50
|
drawGridLines(xa, ya, boundaryLayer, aax, 'a-boundary', aax._boundarylines);
|
|
51
51
|
drawGridLines(xa, ya, boundaryLayer, bax, 'b-boundary', bax._boundarylines);
|
|
@@ -215,7 +215,7 @@ module.exports = function setConvert(trace) {
|
|
|
215
215
|
|
|
216
216
|
var i0 = Math.max(0, Math.min(a.length - 2, i));
|
|
217
217
|
|
|
218
|
-
// The step (
|
|
218
|
+
// The step (denominator) is implicitly 1 since that's the grid spacing.
|
|
219
219
|
return a[i0 + 1] - a[i0];
|
|
220
220
|
};
|
|
221
221
|
|
|
@@ -223,7 +223,7 @@ module.exports = function setConvert(trace) {
|
|
|
223
223
|
// See above caveats for dadi which also apply here
|
|
224
224
|
var j0 = Math.max(0, Math.min(b.length - 2, j));
|
|
225
225
|
|
|
226
|
-
// The step (
|
|
226
|
+
// The step (denominator) is implicitly 1 since that's the grid spacing.
|
|
227
227
|
return b[j0 + 1] - b[j0];
|
|
228
228
|
};
|
|
229
229
|
|
|
@@ -200,7 +200,7 @@ module.exports = function smoothFill2dArray(data, a, b) {
|
|
|
200
200
|
overrelaxation = boundaryCnt ? 0 : 0.85;
|
|
201
201
|
|
|
202
202
|
// If there are four non-null neighbors, then we want a simple average without
|
|
203
|
-
// overrelaxation. If all the
|
|
203
|
+
// overrelaxation. If all the surrounding points are null, then we want the full
|
|
204
204
|
// overrelaxation
|
|
205
205
|
//
|
|
206
206
|
// Based on experiments, this actually seems to slow down convergence just a bit.
|
|
@@ -75,7 +75,7 @@ module.exports = {
|
|
|
75
75
|
],
|
|
76
76
|
description: [
|
|
77
77
|
'This value here applies when hovering over dimensions.',
|
|
78
|
-
'Note
|
|
78
|
+
'Note that `*categorycount`, *colorcount* and *bandcolorcount*',
|
|
79
79
|
'are only available when `hoveron` contains the *color* flag'
|
|
80
80
|
].join(' ')
|
|
81
81
|
}),
|
|
@@ -491,7 +491,7 @@ function plotOne(gd, idx, plotinfo, cdscatter, cdscatterAll, element, transition
|
|
|
491
491
|
join.selectAll('text')
|
|
492
492
|
.call(Drawing.textPointStyle, trace, gd)
|
|
493
493
|
.each(function(d) {
|
|
494
|
-
// This just *has* to be totally custom
|
|
494
|
+
// This just *has* to be totally custom because of SVG text positioning :(
|
|
495
495
|
// It's obviously copied from translatePoint; we just can't use that
|
|
496
496
|
var x = xa.c2p(d.x);
|
|
497
497
|
var y = ya.c2p(d.y);
|
|
@@ -30,7 +30,7 @@ module.exports = function plot(gd, plotinfoproxy, data, layer) {
|
|
|
30
30
|
trace = data[i][0].trace;
|
|
31
31
|
|
|
32
32
|
// Note: .select is adequate but seems to mutate the node data,
|
|
33
|
-
// which is at least a bit
|
|
33
|
+
// which is at least a bit surprising and causes problems elsewhere
|
|
34
34
|
node = layer.selectAll('g.trace' + trace.uid + ' .js-line');
|
|
35
35
|
|
|
36
36
|
// Note: it would be more efficient if this didn't need to be applied
|
package/src/version.js
CHANGED