plotly.js 2.8.0 → 2.9.0

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 (77) hide show
  1. package/.circleci/env_image.sh +1 -1
  2. package/CHANGELOG.md +32 -0
  3. package/README.md +3 -3
  4. package/dist/README.md +26 -26
  5. package/dist/plot-schema.json +315 -0
  6. package/dist/plotly-basic.js +84 -12
  7. package/dist/plotly-basic.min.js +5 -5
  8. package/dist/plotly-cartesian.js +101 -17
  9. package/dist/plotly-cartesian.min.js +3 -3
  10. package/dist/plotly-finance.js +88 -14
  11. package/dist/plotly-finance.min.js +3 -3
  12. package/dist/plotly-geo-assets.js +3 -3
  13. package/dist/plotly-geo.js +76 -11
  14. package/dist/plotly-geo.min.js +3 -3
  15. package/dist/plotly-gl2d.js +79 -13
  16. package/dist/plotly-gl2d.min.js +3 -3
  17. package/dist/plotly-gl3d.js +77 -11
  18. package/dist/plotly-gl3d.min.js +9 -9
  19. package/dist/plotly-locale-cs.js +1 -1
  20. package/dist/plotly-locale-cy.js +1 -1
  21. package/dist/plotly-locale-de.js +1 -1
  22. package/dist/plotly-locale-es.js +1 -1
  23. package/dist/plotly-locale-fi.js +1 -1
  24. package/dist/plotly-locale-fr.js +1 -1
  25. package/dist/plotly-locale-it.js +1 -1
  26. package/dist/plotly-locale-ja.js +1 -1
  27. package/dist/plotly-locale-ko.js +1 -1
  28. package/dist/plotly-locale-pt-br.js +1 -1
  29. package/dist/plotly-locale-pt-pt.js +1 -1
  30. package/dist/plotly-locale-ru.js +1 -1
  31. package/dist/plotly-locale-sv.js +1 -1
  32. package/dist/plotly-locale-sw.js +1 -1
  33. package/dist/plotly-locale-uk.js +1 -1
  34. package/dist/plotly-locale-zh-cn.js +1 -1
  35. package/dist/plotly-mapbox.js +76 -11
  36. package/dist/plotly-mapbox.min.js +3 -3
  37. package/dist/plotly-strict.js +105 -17
  38. package/dist/plotly-strict.min.js +3 -3
  39. package/dist/plotly-with-meta.js +114 -17
  40. package/dist/plotly.js +106 -17
  41. package/dist/plotly.min.js +11 -11
  42. package/dist/translation-keys.txt +1 -1
  43. package/lib/locales/cs.js +1 -1
  44. package/lib/locales/cy.js +1 -1
  45. package/lib/locales/de.js +1 -1
  46. package/lib/locales/es.js +1 -1
  47. package/lib/locales/fi.js +1 -1
  48. package/lib/locales/fr.js +1 -1
  49. package/lib/locales/it.js +1 -1
  50. package/lib/locales/ja.js +1 -1
  51. package/lib/locales/ko.js +1 -1
  52. package/lib/locales/pt-br.js +1 -1
  53. package/lib/locales/pt-pt.js +1 -1
  54. package/lib/locales/ru.js +1 -1
  55. package/lib/locales/sv.js +1 -1
  56. package/lib/locales/sw.js +1 -1
  57. package/lib/locales/uk.js +1 -1
  58. package/lib/locales/zh-cn.js +1 -1
  59. package/package.json +11 -11
  60. package/src/components/colorbar/attributes.js +1 -0
  61. package/src/components/colorbar/draw.js +1 -0
  62. package/src/components/legend/draw.js +2 -1
  63. package/src/components/modebar/modebar.js +7 -1
  64. package/src/plots/cartesian/axes.js +47 -5
  65. package/src/plots/cartesian/layout_attributes.js +14 -0
  66. package/src/plots/cartesian/tick_label_defaults.js +8 -0
  67. package/src/plots/gl3d/layout/axis_defaults.js +1 -0
  68. package/src/plots/polar/layout_attributes.js +1 -0
  69. package/src/plots/smith/layout_defaults.js +1 -0
  70. package/src/plots/ternary/layout_attributes.js +1 -0
  71. package/src/traces/bar/plot.js +8 -1
  72. package/src/traces/carpet/ab_defaults.js +1 -0
  73. package/src/traces/heatmap/plot.js +4 -2
  74. package/src/traces/histogram/calc.js +3 -2
  75. package/src/traces/indicator/attributes.js +1 -0
  76. package/src/version.js +1 -1
  77. package/.vscode/launch.json +0 -0
package/dist/plotly.js CHANGED
@@ -1,6 +1,6 @@
1
1
  /**
2
- * plotly.js v2.8.0
3
- * Copyright 2012-2021, Plotly, Inc.
2
+ * plotly.js v2.9.0
3
+ * Copyright 2012-2022, Plotly, Inc.
4
4
  * All rights reserved.
5
5
  * Licensed under the MIT license
6
6
  */
@@ -86336,7 +86336,15 @@ exports.readUInt32BE = function (data, offset) {
86336
86336
 
86337
86337
  function ProbeError(message, code, statusCode) {
86338
86338
  Error.call(this);
86339
- Error.captureStackTrace(this, this.constructor);
86339
+
86340
+ // Include stack trace in error object
86341
+ if (Error.captureStackTrace) {
86342
+ // Chrome and NodeJS
86343
+ Error.captureStackTrace(this, this.constructor);
86344
+ } else {
86345
+ // FF, IE 10+ and Safari 6+. Fallback for others
86346
+ this.stack = (new Error()).stack || '';
86347
+ }
86340
86348
 
86341
86349
  this.name = this.constructor.name;
86342
86350
 
@@ -106110,6 +106118,7 @@ module.exports = overrideAll({
106110
106118
  ticklen: axesAttrs.ticklen,
106111
106119
  tickwidth: axesAttrs.tickwidth,
106112
106120
  tickcolor: axesAttrs.tickcolor,
106121
+ ticklabelstep: axesAttrs.ticklabelstep,
106113
106122
  showticklabels: axesAttrs.showticklabels,
106114
106123
  tickfont: fontAttrs({
106115
106124
  }),
@@ -107200,6 +107209,7 @@ function mockColorBarAxis(gd, opts, zrange) {
107200
107209
  showticklabels: opts.showticklabels,
107201
107210
  ticklabelposition: opts.ticklabelposition,
107202
107211
  ticklabeloverflow: opts.ticklabeloverflow,
107212
+ ticklabelstep: opts.ticklabelstep,
107203
107213
  tickfont: opts.tickfont,
107204
107214
  tickangle: opts.tickangle,
107205
107215
  tickformat: opts.tickformat,
@@ -116006,7 +116016,6 @@ function computeLegendDimensions(gd, groups, traces, legendObj) {
116006
116016
  offsetY += h;
116007
116017
  maxWidthInGroup = Math.max(maxWidthInGroup, textGap + w);
116008
116018
  });
116009
- maxGroupHeightInRow = Math.max(maxGroupHeightInRow, offsetY);
116010
116019
 
116011
116020
  var next = maxWidthInGroup + itemGap;
116012
116021
 
@@ -116022,6 +116031,8 @@ function computeLegendDimensions(gd, groups, traces, legendObj) {
116022
116031
  groupOffsetX = 0;
116023
116032
  groupOffsetY += maxGroupHeightInRow + traceGroupGap;
116024
116033
  maxGroupHeightInRow = offsetY;
116034
+ } else {
116035
+ maxGroupHeightInRow = Math.max(maxGroupHeightInRow, offsetY);
116025
116036
  }
116026
116037
 
116027
116038
  Drawing.setTranslate(this, groupOffsetX, groupOffsetY);
@@ -118504,6 +118515,8 @@ var isNumeric = _dereq_('fast-isnumeric');
118504
118515
 
118505
118516
  var Lib = _dereq_('../../lib');
118506
118517
  var Icons = _dereq_('../../fonts/ploticon');
118518
+ var version = _dereq_('../../version').version;
118519
+
118507
118520
  var Parser = new DOMParser();
118508
118521
 
118509
118522
  /**
@@ -118782,6 +118795,10 @@ proto.hasButtons = function(buttons) {
118782
118795
  return true;
118783
118796
  };
118784
118797
 
118798
+ function jsVersion(str) {
118799
+ return str + ' (v' + version + ')';
118800
+ }
118801
+
118785
118802
  /**
118786
118803
  * @return {HTMLDivElement} The logo image wrapped in a group
118787
118804
  */
@@ -118791,7 +118808,7 @@ proto.getLogo = function() {
118791
118808
 
118792
118809
  a.href = 'https://plotly.com/';
118793
118810
  a.target = '_blank';
118794
- a.setAttribute('data-title', Lib._(this.graphInfo, 'Produced with Plotly'));
118811
+ a.setAttribute('data-title', jsVersion(Lib._(this.graphInfo, 'Produced with Plotly.js')));
118795
118812
  a.className = 'modebar-btn plotlyjsicon modebar-btn--logo';
118796
118813
 
118797
118814
  a.appendChild(this.createIcon(Icons.newplotlylogo));
@@ -118833,7 +118850,7 @@ function createModeBar(gd, buttons) {
118833
118850
 
118834
118851
  module.exports = createModeBar;
118835
118852
 
118836
- },{"../../fonts/ploticon":482,"../../lib":503,"@plotly/d3":58,"fast-isnumeric":190}],432:[function(_dereq_,module,exports){
118853
+ },{"../../fonts/ploticon":482,"../../lib":503,"../../version":1119,"@plotly/d3":58,"fast-isnumeric":190}],432:[function(_dereq_,module,exports){
118837
118854
  'use strict';
118838
118855
 
118839
118856
  var fontAttrs = _dereq_('../../plots/font_attributes');
@@ -143031,7 +143048,8 @@ axes.calcTicks = function calcTicks(ax, opts) {
143031
143048
  var minRange = Math.min(rng[0], rng[1]);
143032
143049
  var maxRange = Math.max(rng[0], rng[1]);
143033
143050
 
143034
- var isDLog = (ax.type === 'log') && !(isNumeric(ax.dtick) || ax.dtick.charAt(0) === 'L');
143051
+ var numDtick = isNumeric(ax.dtick);
143052
+ var isDLog = (ax.type === 'log') && !(numDtick || ax.dtick.charAt(0) === 'L');
143035
143053
  var isPeriod = ax.ticklabelmode === 'period';
143036
143054
 
143037
143055
  // find the first tick
@@ -143062,13 +143080,36 @@ axes.calcTicks = function calcTicks(ax, opts) {
143062
143080
  x = axes.tickIncrement(x, ax.dtick, !axrev, ax.calendar);
143063
143081
  }
143064
143082
 
143083
+ var ticklabelstep = ax.ticklabelstep;
143084
+
143065
143085
  var maxTicks = Math.max(1000, ax._length || 0);
143066
143086
  var tickVals = [];
143067
143087
  var xPrevious = null;
143088
+
143089
+ var dTick;
143090
+ if(numDtick) {
143091
+ dTick = ax.dtick;
143092
+ } else {
143093
+ if(ax.type === 'date') {
143094
+ if(typeof ax.dtick === 'string' && ax.dtick.charAt(0) === 'M') {
143095
+ dTick = ONEAVGMONTH * ax.dtick.substring(1);
143096
+ }
143097
+ } else {
143098
+ dTick = ax._roughDTick;
143099
+ }
143100
+ }
143101
+
143102
+ var id = Math.round((
143103
+ ax.r2l(x) -
143104
+ ax.r2l(ax.tick0)
143105
+ ) / dTick) - 1;
143106
+
143068
143107
  for(;
143069
143108
  (axrev) ? (x >= endTick) : (x <= endTick);
143070
143109
  x = axes.tickIncrement(x, ax.dtick, axrev, ax.calendar)
143071
143110
  ) {
143111
+ id++;
143112
+
143072
143113
  if(ax.rangebreaks) {
143073
143114
  if(!axrev) {
143074
143115
  if(x < startTick) continue;
@@ -143086,10 +143127,16 @@ axes.calcTicks = function calcTicks(ax, opts) {
143086
143127
  minor = true;
143087
143128
  }
143088
143129
 
143089
- tickVals.push({
143130
+ var obj = {
143090
143131
  minor: minor,
143091
143132
  value: x
143092
- });
143133
+ };
143134
+
143135
+ if(ticklabelstep > 1 && id % ticklabelstep) {
143136
+ obj.skipLabel = true;
143137
+ }
143138
+
143139
+ tickVals.push(obj);
143093
143140
  }
143094
143141
 
143095
143142
  if(isPeriod) positionPeriodTicks(tickVals, ax, ax._definedDelta);
@@ -143142,12 +143189,20 @@ axes.calcTicks = function calcTicks(ax, opts) {
143142
143189
  ax._prevDateHead = '';
143143
143190
  ax._inCalcTicks = true;
143144
143191
 
143192
+ var lastVisibleHead;
143193
+ var hideLabel = function(tick) {
143194
+ tick.text = ' '; // don't use an empty string here which can confuse automargin (issue 5132)
143195
+ ax._prevDateHead = lastVisibleHead;
143196
+ };
143197
+
143145
143198
  var ticksOut = [];
143146
143199
  var t, p;
143147
143200
  for(i = 0; i < tickVals.length; i++) {
143148
143201
  var _minor = tickVals[i].minor;
143149
143202
  var _value = tickVals[i].value;
143150
143203
 
143204
+ lastVisibleHead = ax._prevDateHead;
143205
+
143151
143206
  t = axes.tickText(
143152
143207
  ax,
143153
143208
  _value,
@@ -143162,11 +143217,14 @@ axes.calcTicks = function calcTicks(ax, opts) {
143162
143217
  if(p > maxRange) t.periodX = maxRange;
143163
143218
  if(p < minRange) t.periodX = minRange;
143164
143219
 
143165
- t.text = ' '; // don't use an empty string here which can confuse automargin (issue 5132)
143166
- ax._prevDateHead = '';
143220
+ hideLabel(t);
143167
143221
  }
143168
143222
  }
143169
143223
 
143224
+ if(tickVals[i].skipLabel) {
143225
+ hideLabel(t);
143226
+ }
143227
+
143170
143228
  ticksOut.push(t);
143171
143229
  }
143172
143230
 
@@ -145194,6 +145252,7 @@ axes.drawLabels = function(gd, ax, opts) {
145194
145252
  var axId = ax._id;
145195
145253
  var axLetter = axId.charAt(0);
145196
145254
  var cls = opts.cls || axId + 'tick';
145255
+
145197
145256
  var vals = opts.vals;
145198
145257
 
145199
145258
  var labelFns = opts.labelFns;
@@ -150050,6 +150109,12 @@ module.exports = {
150050
150109
  editType: 'ticks',
150051
150110
  impliedEdits: {tickmode: 'linear'},
150052
150111
  },
150112
+ ticklabelstep: {
150113
+ valType: 'integer',
150114
+ min: 1,
150115
+ dflt: 1,
150116
+ editType: 'ticks',
150117
+ },
150053
150118
  tickvals: {
150054
150119
  valType: 'data_array',
150055
150120
  editType: 'ticks',
@@ -152914,6 +152979,14 @@ module.exports = function handleTickLabelDefaults(containerIn, containerOut, coe
152914
152979
  color: dfltFontColor
152915
152980
  });
152916
152981
 
152982
+ if(
152983
+ !options.noTicklabelstep &&
152984
+ axType !== 'multicategory' &&
152985
+ axType !== 'log'
152986
+ ) {
152987
+ coerce('ticklabelstep');
152988
+ }
152989
+
152917
152990
  if(!options.noAng) coerce('tickangle');
152918
152991
 
152919
152992
  if(axType !== 'category') {
@@ -157822,6 +157895,7 @@ module.exports = function supplyLayoutDefaults(layoutIn, layoutOut, options) {
157822
157895
  showGrid: true,
157823
157896
  noTickson: true,
157824
157897
  noTicklabelmode: true,
157898
+ noTicklabelstep: true,
157825
157899
  noTicklabelposition: true,
157826
157900
  noTicklabeloverflow: true,
157827
157901
  bgColor: options.bgColor,
@@ -165664,6 +165738,7 @@ var axisTickAttrs = overrideAll({
165664
165738
  ticklen: axesAttrs.ticklen,
165665
165739
  tickwidth: axesAttrs.tickwidth,
165666
165740
  tickcolor: axesAttrs.tickcolor,
165741
+ ticklabelstep: axesAttrs.ticklabelstep,
165667
165742
  showticklabels: axesAttrs.showticklabels,
165668
165743
  showtickprefix: axesAttrs.showtickprefix,
165669
165744
  tickprefix: axesAttrs.tickprefix,
@@ -168222,6 +168297,7 @@ function handleDefaults(contIn, contOut, coerce, opts) {
168222
168297
  }
168223
168298
 
168224
168299
  handleTickLabelDefaults(axIn, axOut, coerceAxis, axOut.type, {
168300
+ noTicklabelstep: true,
168225
168301
  noAng: !isRealAxis,
168226
168302
  noExp: true,
168227
168303
  font: {
@@ -168543,6 +168619,7 @@ var ternaryAxesAttrs = {
168543
168619
  ticklen: axesAttrs.ticklen,
168544
168620
  tickwidth: axesAttrs.tickwidth,
168545
168621
  tickcolor: axesAttrs.tickcolor,
168622
+ ticklabelstep: axesAttrs.ticklabelstep,
168546
168623
  showticklabels: axesAttrs.showticklabels,
168547
168624
  showtickprefix: axesAttrs.showtickprefix,
168548
168625
  tickprefix: axesAttrs.tickprefix,
@@ -173021,12 +173098,14 @@ function calcTexttemplate(fullLayout, cd, index, xa, ya) {
173021
173098
  var trace = cd[0].trace;
173022
173099
  var texttemplate = Lib.castOption(trace, index, 'texttemplate');
173023
173100
  if(!texttemplate) return '';
173101
+ var isHistogram = (trace.type === 'histogram');
173024
173102
  var isWaterfall = (trace.type === 'waterfall');
173025
173103
  var isFunnel = (trace.type === 'funnel');
173104
+ var isHorizontal = trace.orientation === 'h';
173026
173105
 
173027
173106
  var pLetter, pAxis;
173028
173107
  var vLetter, vAxis;
173029
- if(trace.orientation === 'h') {
173108
+ if(isHorizontal) {
173030
173109
  pLetter = 'y';
173031
173110
  pAxis = ya;
173032
173111
  vLetter = 'x';
@@ -173061,6 +173140,11 @@ function calcTexttemplate(fullLayout, cd, index, xa, ya) {
173061
173140
  var pt = {};
173062
173141
  appendArrayPointValue(pt, trace, cdi.i);
173063
173142
 
173143
+ if(isHistogram || pt.x === undefined) pt.x = isHorizontal ? obj.value : obj.label;
173144
+ if(isHistogram || pt.y === undefined) pt.y = isHorizontal ? obj.label : obj.value;
173145
+ if(isHistogram || pt.xLabel === undefined) pt.xLabel = isHorizontal ? obj.valueLabel : obj.labelLabel;
173146
+ if(isHistogram || pt.yLabel === undefined) pt.yLabel = isHorizontal ? obj.labelLabel : obj.valueLabel;
173147
+
173064
173148
  if(isWaterfall) {
173065
173149
  obj.delta = +cdi.rawS || cdi.s;
173066
173150
  obj.deltaLabel = formatNumber(obj.delta);
@@ -176317,6 +176401,7 @@ function mimickAxisDefaults(traceIn, traceOut, fullLayout, dfltColor) {
176317
176401
  var axOut = Template.newContainer(traceOut, axName);
176318
176402
 
176319
176403
  var defaultOptions = {
176404
+ noTicklabelstep: true,
176320
176405
  tickfont: 'x',
176321
176406
  id: axLetter + 'axis',
176322
176407
  letter: axLetter,
@@ -186899,6 +186984,7 @@ module.exports = function(gd, plotinfo, cdheatmaps, heatmapLayer) {
186899
186984
  var font = trace.textfont;
186900
186985
  var fontFamily = font.family;
186901
186986
  var fontSize = font.size;
186987
+ var globalFontSize = gd._fullLayout.font.size;
186902
186988
 
186903
186989
  if(!fontSize || fontSize === 'auto') {
186904
186990
  var minW = Infinity;
@@ -186925,7 +187011,7 @@ module.exports = function(gd, plotinfo, cdheatmaps, heatmapLayer) {
186925
187011
  !isFinite(minW) ||
186926
187012
  !isFinite(minH)
186927
187013
  ) {
186928
- fontSize = 12;
187014
+ fontSize = globalFontSize;
186929
187015
  } else {
186930
187016
  minW -= xGap;
186931
187017
  minH -= yGap;
@@ -186938,7 +187024,8 @@ module.exports = function(gd, plotinfo, cdheatmaps, heatmapLayer) {
186938
187024
 
186939
187025
  fontSize = Math.min(
186940
187026
  Math.floor(minW),
186941
- Math.floor(minH)
187027
+ Math.floor(minH),
187028
+ globalFontSize
186942
187029
  );
186943
187030
  }
186944
187031
  }
@@ -187826,8 +187913,9 @@ var getBinSpanLabelRound = _dereq_('./bin_label_vals');
187826
187913
  function calc(gd, trace) {
187827
187914
  var pos = [];
187828
187915
  var size = [];
187829
- var pa = Axes.getFromId(gd, trace.orientation === 'h' ? trace.yaxis : trace.xaxis);
187830
- var mainData = trace.orientation === 'h' ? 'y' : 'x';
187916
+ var isHorizontal = trace.orientation === 'h';
187917
+ var pa = Axes.getFromId(gd, isHorizontal ? trace.yaxis : trace.xaxis);
187918
+ var mainData = isHorizontal ? 'y' : 'x';
187831
187919
  var counterData = {x: 'y', y: 'x'}[mainData];
187832
187920
  var calendar = trace[mainData + 'calendar'];
187833
187921
  var cumulativeSpec = trace.cumulative;
@@ -190834,6 +190922,7 @@ module.exports = {
190834
190922
  ticklen: axesAttrs.ticklen,
190835
190923
  tickwidth: axesAttrs.tickwidth,
190836
190924
  tickcolor: axesAttrs.tickcolor,
190925
+ ticklabelstep: axesAttrs.ticklabelstep,
190837
190926
  showticklabels: axesAttrs.showticklabels,
190838
190927
  tickfont: fontAttrs({
190839
190928
  }),
@@ -224081,7 +224170,7 @@ function getSortFunc(opts, d2c) {
224081
224170
  'use strict';
224082
224171
 
224083
224172
  // package version injected by `npm run preprocess`
224084
- exports.version = '2.8.0';
224173
+ exports.version = '2.9.0';
224085
224174
 
224086
224175
  },{}],1120:[function(_dereq_,module,exports){
224087
224176
  (function (global){(function (){