plotly.js 2.12.0 → 2.12.1

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/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "plotly.js",
3
- "version": "2.12.0",
3
+ "version": "2.12.1",
4
4
  "description": "The open source javascript graphing library that powers plotly",
5
5
  "license": "MIT",
6
6
  "main": "./lib/index.js",
@@ -127,30 +127,30 @@
127
127
  "browserify": "^17.0.0",
128
128
  "browserify-transform-tools": "^1.7.0",
129
129
  "bubleify": "^2.0.0",
130
- "canvas": "^2.9.0",
130
+ "canvas": "^2.9.1",
131
131
  "check-node-version": "^4.2.1",
132
132
  "chttps": "^1.0.6",
133
133
  "deep-equal": "^2.0.5",
134
134
  "derequire": "^2.1.1",
135
135
  "ecstatic": "^4.1.4",
136
- "eslint": "^8.10.0",
136
+ "eslint": "^8.14.0",
137
137
  "extra-iterable": "^2.5.22",
138
138
  "falafel": "^2.2.4",
139
- "fs-extra": "^10.0.1",
140
- "fuse.js": "^6.5.3",
139
+ "fs-extra": "^10.1.0",
140
+ "fuse.js": "^6.6.1",
141
141
  "glob": "^7.2.0",
142
142
  "gzip-size": "^6.0.0",
143
143
  "into-stream": "^6.0.0",
144
144
  "jasmine-core": "^3.5.0",
145
145
  "jsdom": "^19.0.0",
146
- "karma": "^6.3.17",
146
+ "karma": "^6.3.19",
147
147
  "karma-browserify": "^8.1.0",
148
- "karma-chrome-launcher": "^3.1.0",
148
+ "karma-chrome-launcher": "^3.1.1",
149
149
  "karma-firefox-launcher": "^2.1.2",
150
150
  "karma-ie-launcher": "^1.0.0",
151
151
  "karma-jasmine": "^3.3.1",
152
152
  "karma-jasmine-spec-tags": "^1.3.0",
153
- "karma-spec-reporter": "^0.0.33",
153
+ "karma-spec-reporter": "^0.0.34",
154
154
  "karma-verbose-reporter": "^0.0.8",
155
155
  "karma-viewport": "1.0.2",
156
156
  "lodash": "^4.17.21",
@@ -160,13 +160,13 @@
160
160
  "minify-stream": "^2.1.0",
161
161
  "npm-link-check": "^4.0.0",
162
162
  "open": "^8.4.0",
163
- "pixelmatch": "^5.2.1",
163
+ "pixelmatch": "^5.3.0",
164
164
  "prepend-file": "^2.0.1",
165
165
  "prettysize": "^2.0.0",
166
166
  "read-last-lines": "^1.8.0",
167
167
  "run-series": "^1.1.9",
168
168
  "sane-topojson": "^4.0.0",
169
- "sass": "^1.49.9",
169
+ "sass": "^1.51.0",
170
170
  "through2": "^4.0.2",
171
171
  "true-case-path": "^2.2.1",
172
172
  "watchify": "^4.0.0"
@@ -77,7 +77,7 @@ module.exports = function colorScaleAttrs(context, opts) {
77
77
  }
78
78
 
79
79
  var effectDesc = onlyIfNumerical ?
80
- ' Has an effect only if ' + colorAttrFull + 'is set to a numerical array.' :
80
+ ' Has an effect only if ' + colorAttrFull + ' is set to a numerical array.' :
81
81
  '';
82
82
 
83
83
  var auto = cLetter + 'auto';
@@ -102,11 +102,11 @@ module.exports = function colorScaleAttrs(context, opts) {
102
102
  editType: editTypeOverride || 'style',
103
103
  description: [
104
104
  'Sets the', context, 'color.',
105
- ' It accepts either a specific color',
106
- ' or an array of numbers that are mapped to the colorscale',
107
- ' relative to the max and min values of the array or relative to',
108
- ' ' + minmaxFull + ' if set.'
109
- ].join('')
105
+ 'It accepts either a specific color',
106
+ 'or an array of numbers that are mapped to the colorscale',
107
+ 'relative to the max and min values of the array or relative to',
108
+ minmaxFull, 'if set.'
109
+ ].join(' ')
110
110
  };
111
111
 
112
112
  if(opts.anim) {
@@ -121,11 +121,10 @@ module.exports = function colorScaleAttrs(context, opts) {
121
121
  impliedEdits: autoImpliedEdits,
122
122
  description: [
123
123
  'Determines whether or not the color domain is computed',
124
- ' with respect to the input data (here ' + colorAttrFull + ') or the bounds set in',
125
- ' ', minmaxFull,
126
- ' ', effectDesc,
127
- ' Defaults to `false` when ', minmaxFull, ' are set by the user.'
128
- ].join('')
124
+ 'with respect to the input data (here ' + colorAttrFull + ') or the bounds set in',
125
+ minmaxFull + effectDesc,
126
+ 'Defaults to `false` when', minmaxFull, 'are set by the user.'
127
+ ].join(' ')
129
128
  };
130
129
 
131
130
  attrs[min] = {
@@ -134,11 +133,10 @@ module.exports = function colorScaleAttrs(context, opts) {
134
133
  editType: editTypeOverride || 'plot',
135
134
  impliedEdits: minmaxImpliedEdits,
136
135
  description: [
137
- 'Sets the lower bound of the color domain.',
138
- effectDesc,
139
- ' Value should have the same units as ', colorAttrFull,
140
- ' and if set, ', maxFull, ' must be set as well.'
141
- ].join('')
136
+ 'Sets the lower bound of the color domain.' + effectDesc,
137
+ 'Value should have the same units as', colorAttrFull,
138
+ 'and if set,', maxFull, 'must be set as well.'
139
+ ].join(' ')
142
140
  };
143
141
 
144
142
  attrs[max] = {
@@ -147,11 +145,10 @@ module.exports = function colorScaleAttrs(context, opts) {
147
145
  editType: editTypeOverride || 'plot',
148
146
  impliedEdits: minmaxImpliedEdits,
149
147
  description: [
150
- 'Sets the upper bound of the color domain.',
151
- effectDesc,
152
- ' Value should have the same units as ', colorAttrFull,
153
- ' and if set, ', minFull, ' must be set as well.'
154
- ].join('')
148
+ 'Sets the upper bound of the color domain.' + effectDesc,
149
+ 'Value should have the same units as', colorAttrFull,
150
+ 'and if set,', minFull, 'must be set as well.'
151
+ ].join(' ')
155
152
  };
156
153
 
157
154
  attrs[mid] = {
@@ -160,12 +157,11 @@ module.exports = function colorScaleAttrs(context, opts) {
160
157
  editType: 'calc',
161
158
  impliedEdits: autoImpliedEdits,
162
159
  description: [
163
- 'Sets the mid-point of the color domain by scaling ', minFull,
164
- ' and/or ', maxFull, ' to be equidistant to this point.',
165
- effectDesc,
166
- ' Value should have the same units as ', colorAttrFull, '. ',
167
- 'Has no effect when ', autoFull, ' is `false`.'
168
- ].join('')
160
+ 'Sets the mid-point of the color domain by scaling', minFull,
161
+ 'and/or', maxFull, 'to be equidistant to this point.' + effectDesc,
162
+ 'Value should have the same units as', colorAttrFull + '.',
163
+ 'Has no effect when', autoFull, 'is `false`.'
164
+ ].join(' ')
169
165
  };
170
166
 
171
167
  attrs.colorscale = {
@@ -174,19 +170,18 @@ module.exports = function colorScaleAttrs(context, opts) {
174
170
  dflt: colorscaleDflt,
175
171
  impliedEdits: {autocolorscale: false},
176
172
  description: [
177
- 'Sets the colorscale.',
178
- effectDesc,
179
- ' The colorscale must be an array containing',
180
- ' arrays mapping a normalized value to an',
181
- ' rgb, rgba, hex, hsl, hsv, or named color string.',
182
- ' At minimum, a mapping for the lowest (0) and highest (1)',
183
- ' values are required. For example,',
184
- ' `[[0, \'rgb(0,0,255)\'], [1, \'rgb(255,0,0)\']]`.',
185
- ' To control the bounds of the colorscale in color space,',
186
- ' use', minmaxFull, '.',
187
- ' Alternatively, `colorscale` may be a palette name string',
188
- ' of the following list: ' + paletteStr + '.'
189
- ].join('')
173
+ 'Sets the colorscale.' + effectDesc,
174
+ 'The colorscale must be an array containing',
175
+ 'arrays mapping a normalized value to an',
176
+ 'rgb, rgba, hex, hsl, hsv, or named color string.',
177
+ 'At minimum, a mapping for the lowest (0) and highest (1)',
178
+ 'values are required. For example,',
179
+ '`[[0, \'rgb(0,0,255)\'], [1, \'rgb(255,0,0)\']]`.',
180
+ 'To control the bounds of the colorscale in color space,',
181
+ 'use', minmaxFull + '.',
182
+ 'Alternatively, `colorscale` may be a palette name string',
183
+ 'of the following list: ' + paletteStr + '.'
184
+ ].join(' ')
190
185
  };
191
186
 
192
187
  attrs.autocolorscale = {
@@ -197,12 +192,11 @@ module.exports = function colorScaleAttrs(context, opts) {
197
192
  impliedEdits: {colorscale: undefined},
198
193
  description: [
199
194
  'Determines whether the colorscale is a default palette (`autocolorscale: true`)',
200
- ' or the palette determined by ', code(contextHead + 'colorscale'), '.',
201
- effectDesc,
202
- ' In case `colorscale` is unspecified or `autocolorscale` is true, the default ',
203
- ' palette will be chosen according to whether numbers in the `color` array are',
204
- ' all positive, all negative or mixed.'
205
- ].join('')
195
+ 'or the palette determined by', code(contextHead + 'colorscale') + '.' + effectDesc,
196
+ 'In case `colorscale` is unspecified or `autocolorscale` is true, the default',
197
+ 'palette will be chosen according to whether numbers in the `color` array are',
198
+ 'all positive, all negative or mixed.'
199
+ ].join(' ')
206
200
  };
207
201
 
208
202
  attrs.reversescale = {
@@ -210,11 +204,10 @@ module.exports = function colorScaleAttrs(context, opts) {
210
204
  dflt: false,
211
205
  editType: 'plot',
212
206
  description: [
213
- 'Reverses the color mapping if true.',
214
- effectDesc,
215
- ' If true, ', minFull, ' will correspond to the last color',
216
- ' in the array and ', maxFull, ' will correspond to the first color.'
217
- ].join('')
207
+ 'Reverses the color mapping if true.' + effectDesc,
208
+ 'If true,', minFull, 'will correspond to the last color',
209
+ 'in the array and', maxFull, 'will correspond to the first color.'
210
+ ].join(' ')
218
211
  };
219
212
 
220
213
  if(!noScale) {
@@ -223,9 +216,8 @@ module.exports = function colorScaleAttrs(context, opts) {
223
216
  dflt: showScaleDflt,
224
217
  editType: 'calc',
225
218
  description: [
226
- 'Determines whether or not a colorbar is displayed for this trace.',
227
- effectDesc
228
- ].join('')
219
+ 'Determines whether or not a colorbar is displayed for this trace.' + effectDesc
220
+ ].join(' ')
229
221
  };
230
222
 
231
223
  attrs.colorbar = colorbarAttrs;
@@ -8,6 +8,7 @@ var isUnifiedHover = require('../fx/helpers').isUnifiedHover;
8
8
  var createModeBar = require('./modebar');
9
9
  var modeBarButtons = require('./buttons');
10
10
  var DRAW_MODES = require('./constants').DRAW_MODES;
11
+ var extendDeep = require('../../lib').extendDeep;
11
12
 
12
13
  /**
13
14
  * ModeBar wrapper around 'create' and 'update',
@@ -330,7 +331,9 @@ function appendButtonsToGroups(groups, buttons) {
330
331
  }
331
332
 
332
333
  // fill in custom buttons referring to default mode bar buttons
333
- function fillCustomButton(customButtons) {
334
+ function fillCustomButton(originalModeBarButtons) {
335
+ var customButtons = extendDeep([], originalModeBarButtons);
336
+
334
337
  for(var i = 0; i < customButtons.length; i++) {
335
338
  var buttonGroup = customButtons[i];
336
339
 
@@ -2171,7 +2171,9 @@ function _relayout(gd, aobj) {
2171
2171
  if(parentFull.autorange) flags.calc = true;
2172
2172
  else flags.plot = true;
2173
2173
  } else {
2174
- if((fullLayout._has('scatter-like') && fullLayout._has('regl')) &&
2174
+ if(ai === 'dragmode' && ((vi === false && vOld !== false) || (vi !== false && vOld === false))) {
2175
+ flags.plot = true;
2176
+ } else if((fullLayout._has('scatter-like') && fullLayout._has('regl')) &&
2175
2177
  (ai === 'dragmode' &&
2176
2178
  (vi === 'lasso' || vi === 'select') &&
2177
2179
  !(vOld === 'lasso' || vOld === 'select'))
@@ -119,7 +119,7 @@ proto.fetchTopojson = function() {
119
119
  if(err.status === 404) {
120
120
  return reject(new Error([
121
121
  'plotly.js could not find topojson file at',
122
- topojsonPath, '.',
122
+ topojsonPath + '.',
123
123
  'Make sure the *topojsonURL* plot config option',
124
124
  'is set properly.'
125
125
  ].join(' ')));
@@ -800,7 +800,7 @@ proto.updateHoverAndMainDrag = function(fullLayout) {
800
800
  var scaleX;
801
801
  var scaleY;
802
802
 
803
- var mainDrag = dragBox.makeDragger(layers, 'path', 'maindrag', 'crosshair');
803
+ var mainDrag = dragBox.makeDragger(layers, 'path', 'maindrag', fullLayout.dragmode === false ? 'none' : 'crosshair');
804
804
 
805
805
  d3.select(mainDrag)
806
806
  .attr('d', _this.pathSubplot())
@@ -1150,6 +1150,9 @@ proto.updateRadialDrag = function(fullLayout, polarLayout, rngIndex) {
1150
1150
 
1151
1151
  var radialDrag = dragBox.makeRectDragger(layers, className, 'crosshair', -bl2, -bl2, bl, bl);
1152
1152
  var dragOpts = {element: radialDrag, gd: gd};
1153
+ if(fullLayout.dragmode === false) {
1154
+ dragOpts.dragmode = false;
1155
+ }
1153
1156
 
1154
1157
  updateElement(d3.select(radialDrag), radialAxis.visible && innerRadius < radius, {
1155
1158
  transform: strTranslate(tx, ty)
@@ -1292,13 +1295,17 @@ proto.updateAngularDrag = function(fullLayout) {
1292
1295
  var cyy = _this.cyy;
1293
1296
  var dbs = constants.angularDragBoxSize;
1294
1297
 
1295
- var angularDrag = dragBox.makeDragger(layers, 'path', 'angulardrag', 'move');
1298
+ var angularDrag = dragBox.makeDragger(layers, 'path', 'angulardrag', fullLayout.dragmode === false ? 'none' : 'move');
1296
1299
  var dragOpts = {element: angularDrag, gd: gd};
1297
1300
 
1298
- d3.select(angularDrag)
1299
- .attr('d', _this.pathAnnulus(radius, radius + dbs))
1300
- .attr('transform', strTranslate(cx, cy))
1301
- .call(setCursor, 'move');
1301
+ if(fullLayout.dragmode === false) {
1302
+ dragOpts.dragmode = false;
1303
+ } else {
1304
+ d3.select(angularDrag)
1305
+ .attr('d', _this.pathAnnulus(radius, radius + dbs))
1306
+ .attr('transform', strTranslate(cx, cy))
1307
+ .call(setCursor, 'move');
1308
+ }
1302
1309
 
1303
1310
  function xy2a(x, y) {
1304
1311
  return Math.atan2(cyy + dbs - y, x - cxx - dbs);
package/src/registry.js CHANGED
@@ -276,7 +276,7 @@ function registerTraceModule(_module) {
276
276
  // add `PlotlyGeoAssets` global to stash references to all fetched
277
277
  // topojson / geojson data
278
278
  if((bpmName === 'geo' || bpmName === 'mapbox') &&
279
- (typeof window !== undefined && window.PlotlyGeoAssets === undefined)
279
+ (window.PlotlyGeoAssets === undefined)
280
280
  ) {
281
281
  window.PlotlyGeoAssets = {topojson: {}};
282
282
  }
@@ -53,7 +53,7 @@ module.exports = {
53
53
  'Sets the marker fill color. It accepts a specific color.',
54
54
  'If the color is not fully opaque and there are hundreds of thousands',
55
55
  'of points, it may cause slower zooming and panning.'
56
- ].join('')
56
+ ].join(' ')
57
57
  },
58
58
  opacity: {
59
59
  valType: 'number',
@@ -249,17 +249,13 @@ var attrs = module.exports = overrideAll({
249
249
  valType: 'number',
250
250
  editType: 'calc',
251
251
  dflt: 1,
252
- description: [
253
- 'Sets the upper bound of the color domain.'
254
- ].join('')
252
+ description: 'Sets the upper bound of the color domain.'
255
253
  },
256
254
  cmin: {
257
255
  valType: 'number',
258
256
  editType: 'calc',
259
257
  dflt: 0,
260
- description: [
261
- 'Sets the lower bound of the color domain.'
262
- ].join('')
258
+ description: 'Sets the lower bound of the color domain.'
263
259
  },
264
260
  colorscale: extendFlat(colorAttributes().colorscale, {dflt: [[0, 'white'], [1, 'black']]})
265
261
  }),
@@ -276,16 +276,16 @@ colorScaleAttrs('', {
276
276
  editType: 'calc',
277
277
  description: [
278
278
  'Sets the opacityscale.',
279
- ' The opacityscale must be an array containing',
280
- ' arrays mapping a normalized value to an opacity value.',
281
- ' At minimum, a mapping for the lowest (0) and highest (1)',
282
- ' values are required. For example,',
283
- ' `[[0, 1], [0.5, 0.2], [1, 1]]` means that higher/lower values would have',
284
- ' higher opacity values and those in the middle would be more transparent',
285
- ' Alternatively, `opacityscale` may be a palette name string',
286
- ' of the following list: \'min\', \'max\', \'extremes\' and \'uniform\'.',
287
- ' The default is \'uniform\'.'
288
- ].join('')
279
+ 'The opacityscale must be an array containing',
280
+ 'arrays mapping a normalized value to an opacity value.',
281
+ 'At minimum, a mapping for the lowest (0) and highest (1)',
282
+ 'values are required. For example,',
283
+ '`[[0, 1], [0.5, 0.2], [1, 1]]` means that higher/lower values would have',
284
+ 'higher opacity values and those in the middle would be more transparent',
285
+ 'Alternatively, `opacityscale` may be a palette name string',
286
+ 'of the following list: \'min\', \'max\', \'extremes\' and \'uniform\'.',
287
+ 'The default is \'uniform\'.'
288
+ ].join(' ')
289
289
  },
290
290
 
291
291
  _deprecated: {
@@ -89,8 +89,8 @@ var attrs = module.exports = overrideAll({
89
89
  dflt: 'white',
90
90
  description: [
91
91
  'Sets the cell fill color. It accepts either a specific color',
92
- ' or an array of colors or a 2D array of colors.'
93
- ].join('')
92
+ 'or an array of colors or a 2D array of colors.'
93
+ ].join(' ')
94
94
  }
95
95
  },
96
96
 
@@ -157,8 +157,8 @@ var attrs = module.exports = overrideAll({
157
157
  dflt: 'white',
158
158
  description: [
159
159
  'Sets the cell fill color. It accepts either a specific color',
160
- ' or an array of colors or a 2D array of colors.'
161
- ].join('')
160
+ 'or an array of colors or a 2D array of colors.'
161
+ ].join(' ')
162
162
  }
163
163
  },
164
164
 
@@ -64,7 +64,7 @@ module.exports = {
64
64
  '*width* means each violin has the same (max) width',
65
65
  '*count* means the violins are scaled by the number of sample points making',
66
66
  'up each violin.'
67
- ].join('')
67
+ ].join(' ')
68
68
  },
69
69
 
70
70
  spanmode: {
package/src/version.js CHANGED
@@ -1,4 +1,4 @@
1
1
  'use strict';
2
2
 
3
3
  // package version injected by `npm run preprocess`
4
- exports.version = '2.12.0';
4
+ exports.version = '2.12.1';