plotly.js 1.52.1 → 1.52.2

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.
Files changed (43) hide show
  1. package/.fossa.yml +58 -0
  2. package/.ignore +3 -0
  3. package/CHANGELOG.md +21 -0
  4. package/dist/README.md +25 -25
  5. package/dist/plot-schema.json +8 -8
  6. package/dist/plotly-basic.js +187 -54
  7. package/dist/plotly-basic.min.js +2 -2
  8. package/dist/plotly-cartesian.js +187 -54
  9. package/dist/plotly-cartesian.min.js +2 -2
  10. package/dist/plotly-finance.js +187 -54
  11. package/dist/plotly-finance.min.js +2 -2
  12. package/dist/plotly-geo-assets.js +2 -2
  13. package/dist/plotly-geo.js +168 -49
  14. package/dist/plotly-geo.min.js +2 -2
  15. package/dist/plotly-gl2d.js +173 -51
  16. package/dist/plotly-gl2d.min.js +2 -2
  17. package/dist/plotly-gl3d.js +668 -449
  18. package/dist/plotly-gl3d.min.js +2 -2
  19. package/dist/plotly-mapbox.js +170 -50
  20. package/dist/plotly-mapbox.min.js +2 -2
  21. package/dist/plotly-with-meta.js +823 -533
  22. package/dist/plotly.js +814 -525
  23. package/dist/plotly.min.js +2 -2
  24. package/package.json +24 -23
  25. package/src/assets/geo_assets.js +1 -1
  26. package/src/components/annotations/attributes.js +1 -1
  27. package/src/core.js +1 -1
  28. package/src/lib/index.js +6 -3
  29. package/src/plot_api/subroutines.js +6 -0
  30. package/src/plot_api/validate.js +4 -3
  31. package/src/plots/cartesian/axes.js +6 -2
  32. package/src/plots/cartesian/constants.js +1 -2
  33. package/src/plots/cartesian/layout_defaults.js +112 -27
  34. package/src/plots/gl3d/scene.js +361 -323
  35. package/src/plots/layout_attributes.js +2 -2
  36. package/src/plots/mapbox/layers.js +2 -1
  37. package/src/plots/plots.js +30 -9
  38. package/src/traces/bar/hover.js +6 -1
  39. package/src/traces/bar/plot.js +13 -4
  40. package/src/traces/mesh3d/convert.js +9 -5
  41. package/src/traces/pie/attributes.js +7 -6
  42. package/src/traces/treemap/plot.js +2 -0
  43. package/tasks/test_syntax.js +1 -1
@@ -269,7 +269,7 @@ module.exports = {
269
269
  role: 'style',
270
270
  dflt: colorAttrs.background,
271
271
  editType: 'plot',
272
- description: 'Sets the color of paper where the graph is drawn.'
272
+ description: 'Sets the background color of the paper where the graph is drawn.'
273
273
  },
274
274
  plot_bgcolor: {
275
275
  // defined here, but set in cartesian.supplyLayoutDefaults
@@ -279,7 +279,7 @@ module.exports = {
279
279
  dflt: colorAttrs.background,
280
280
  editType: 'layoutstyle',
281
281
  description: [
282
- 'Sets the color of plotting area in-between x and y axes.'
282
+ 'Sets the background color of the plotting area in-between x and y axes.'
283
283
  ].join(' ')
284
284
  },
285
285
  separators: {
@@ -246,7 +246,8 @@ function convertOpts(opts) {
246
246
  break;
247
247
  case 'raster':
248
248
  Lib.extendFlat(paint, {
249
- 'raster-fade-duration': 0
249
+ 'raster-fade-duration': 0,
250
+ 'raster-opacity': opts.opacity
250
251
  });
251
252
  break;
252
253
  }
@@ -1272,10 +1272,13 @@ plots.supplyTraceDefaults = function(traceIn, traceOut, colorIndex, layout, trac
1272
1272
  var subplots = layout._subplots;
1273
1273
  var subplotId = '';
1274
1274
 
1275
- // TODO - currently if we draw an empty gl2d subplot, it draws
1276
- // nothing then gets stuck and you can't get it back without newPlot
1277
- // sort this out in the regl refactor? but for now just drop empty gl2d subplots
1278
- if(basePlotModule.name !== 'gl2d' || visible) {
1275
+ if(
1276
+ visible ||
1277
+ basePlotModule.name !== 'gl2d' // for now just drop empty gl2d subplots
1278
+ // TODO - currently if we draw an empty gl2d subplot, it draws
1279
+ // nothing then gets stuck and you can't get it back without newPlot
1280
+ // sort this out in the regl refactor?
1281
+ ) {
1279
1282
  if(Array.isArray(subplotAttr)) {
1280
1283
  for(i = 0; i < subplotAttr.length; i++) {
1281
1284
  var attri = subplotAttr[i];
@@ -2934,7 +2937,7 @@ plots.doCalcdata = function(gd, traces) {
2934
2937
  calcdata[i] = cd;
2935
2938
  }
2936
2939
 
2937
- setupAxisCategories(axList, fullData);
2940
+ setupAxisCategories(axList, fullData, fullLayout);
2938
2941
 
2939
2942
  // 'transform' loop - must calc container traces first
2940
2943
  // so that if their dependent traces can get transform properly
@@ -2942,7 +2945,7 @@ plots.doCalcdata = function(gd, traces) {
2942
2945
  for(i = 0; i < fullData.length; i++) transformCalci(i);
2943
2946
 
2944
2947
  // clear stuff that should recomputed in 'regular' loop
2945
- if(hasCalcTransform) setupAxisCategories(axList, fullData);
2948
+ if(hasCalcTransform) setupAxisCategories(axList, fullData, fullLayout);
2946
2949
 
2947
2950
  // 'regular' loop - make sure container traces (eg carpet) calc before
2948
2951
  // contained traces (eg contourcarpet)
@@ -3147,13 +3150,31 @@ function sortAxisCategoriesByValue(axList, gd) {
3147
3150
  return affectedTraces;
3148
3151
  }
3149
3152
 
3150
- function setupAxisCategories(axList, fullData) {
3151
- for(var i = 0; i < axList.length; i++) {
3152
- var ax = axList[i];
3153
+ function setupAxisCategories(axList, fullData, fullLayout) {
3154
+ var axLookup = {};
3155
+ var i, ax, axId;
3156
+
3157
+ for(i = 0; i < axList.length; i++) {
3158
+ ax = axList[i];
3159
+ axId = ax._id;
3160
+
3153
3161
  ax.clearCalc();
3154
3162
  if(ax.type === 'multicategory') {
3155
3163
  ax.setupMultiCategory(fullData);
3156
3164
  }
3165
+
3166
+ axLookup[ax._id] = 1;
3167
+ }
3168
+
3169
+ // look into match groups for 'missing' axes
3170
+ var matchGroups = fullLayout._axisMatchGroups || [];
3171
+ for(i = 0; i < matchGroups.length; i++) {
3172
+ for(axId in matchGroups[i]) {
3173
+ if(!axLookup[axId]) {
3174
+ ax = fullLayout[axisIDs.id2name(axId)];
3175
+ ax.clearCalc();
3176
+ }
3177
+ }
3157
3178
  }
3158
3179
  }
3159
3180
 
@@ -91,7 +91,12 @@ function hoverOnBars(pointData, xval, yval, hovermode) {
91
91
  var s = di[sizeLetter];
92
92
 
93
93
  if(isWaterfall) {
94
- s += Math.abs(di.rawS || 0);
94
+ var rawS = Math.abs(di.rawS) || 0;
95
+ if(v > 0) {
96
+ s += rawS;
97
+ } else if(v < 0) {
98
+ s -= rawS;
99
+ }
95
100
  }
96
101
 
97
102
  // add a gradient so hovering near the end of a
@@ -147,6 +147,7 @@ function plot(gd, plotinfo, cdModule, traceLayer, opts, makeOnCompleteCallback)
147
147
  !isNumeric(y0) ||
148
148
  !isNumeric(y1)
149
149
  );
150
+
150
151
  // display zeros if line.width > 0
151
152
  if(isBlank && shouldDisplayZeros && helpers.getLineWidth(trace, di) && (isHorizontal ? x1 - x0 === 0 : y1 - y0 === 0)) {
152
153
  isBlank = false;
@@ -156,6 +157,9 @@ function plot(gd, plotinfo, cdModule, traceLayer, opts, makeOnCompleteCallback)
156
157
  if(isBlank && isHorizontal) x1 = x0;
157
158
  if(isBlank && !isHorizontal) y1 = y0;
158
159
 
160
+ var spansHorizontal = isHorizontal && (x0 !== x1);
161
+ var spansVertical = !isHorizontal && (y0 !== y1);
162
+
159
163
  // in waterfall mode `between` we need to adjust bar end points to match the connector width
160
164
  if(adjustPixel && !isBlank) {
161
165
  if(isHorizontal) {
@@ -210,10 +214,15 @@ function plot(gd, plotinfo, cdModule, traceLayer, opts, makeOnCompleteCallback)
210
214
 
211
215
  var op = Color.opacity(mc);
212
216
  var fixpx = (op < 1 || lw > 0.01) ? roundWithLine : expandToVisible;
213
- x0 = fixpx(x0, x1);
214
- x1 = fixpx(x1, x0);
215
- y0 = fixpx(y0, y1);
216
- y1 = fixpx(y1, y0);
217
+
218
+ if(spansHorizontal) {
219
+ x0 = fixpx(x0, x1);
220
+ x1 = fixpx(x1, x0);
221
+ }
222
+ if(spansVertical) {
223
+ y0 = fixpx(y0, y1);
224
+ y1 = fixpx(y1, y0);
225
+ }
217
226
  }
218
227
 
219
228
  var sel = transition(Lib.ensureSingle(bar, 'path'), fullLayout, opts, makeOnCompleteCallback);
@@ -34,11 +34,15 @@ proto.handlePick = function(selection) {
34
34
  if(selection.object === this.mesh) {
35
35
  var selectIndex = selection.index = selection.data.index;
36
36
 
37
- selection.traceCoordinate = [
38
- this.data.x[selectIndex],
39
- this.data.y[selectIndex],
40
- this.data.z[selectIndex]
41
- ];
37
+ if(selection.data._cellCenter) {
38
+ selection.traceCoordinate = selection.data.dataCoordinate;
39
+ } else {
40
+ selection.traceCoordinate = [
41
+ this.data.x[selectIndex],
42
+ this.data.y[selectIndex],
43
+ this.data.z[selectIndex]
44
+ ];
45
+ }
42
46
 
43
47
  var text = this.data.hovertext || this.data.text;
44
48
  if(Array.isArray(text) && text[selectIndex] !== undefined) {
@@ -188,12 +188,13 @@ module.exports = {
188
188
  dflt: 'auto',
189
189
  editType: 'plot',
190
190
  description: [
191
- 'Determines the orientation of text inside slices.',
192
- 'With *auto* the texts may automatically be',
193
- 'rotated to fit with the maximum size inside the slice.',
194
- 'Using *horizontal* option forces text to be horizontal.',
195
- 'Using *radial* option forces text to be radial.',
196
- 'Using *tangential* option forces text to be tangential.'
191
+ 'Controls the orientation of the text inside chart sectors.',
192
+ 'When set to *auto*, text may be oriented in any direction in order',
193
+ 'to be as big as possible in the middle of a sector.',
194
+ 'The *horizontal* option orients text to be parallel with the bottom',
195
+ 'of the chart, and may make text smaller in order to achieve that goal.',
196
+ 'The *radial* option orients text along the radius of the sector.',
197
+ 'The *tangential* option orients text perpendicular to the radius of the sector.'
197
198
  ].join(' ')
198
199
  },
199
200
  insidetextfont: extendFlat({}, textFontAttrs, {
@@ -627,5 +627,7 @@ function plotOne(gd, cd, element, transitionOpts) {
627
627
  hasTransition: hasTransition,
628
628
  strTransform: strTransform
629
629
  });
630
+ } else {
631
+ selAncestors.remove();
630
632
  }
631
633
  }
@@ -6,7 +6,7 @@ var glob = require('glob');
6
6
  var madge = require('madge');
7
7
  var readLastLines = require('read-last-lines');
8
8
  var eslint = require('eslint');
9
- var trueCasePath = require('true-case-path');
9
+ var trueCasePath = require('true-case-path').trueCasePathSync;
10
10
 
11
11
  var common = require('./util/common');
12
12
  var isJasmineTestIt = common.isJasmineTestIt;