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
@@ -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
 
@@ -106402,6 +106410,7 @@ module.exports = overrideAll({
106402
106410
  ticklen: axesAttrs.ticklen,
106403
106411
  tickwidth: axesAttrs.tickwidth,
106404
106412
  tickcolor: axesAttrs.tickcolor,
106413
+ ticklabelstep: axesAttrs.ticklabelstep,
106405
106414
  showticklabels: axesAttrs.showticklabels,
106406
106415
  tickfont: fontAttrs({
106407
106416
  description: 'Sets the color bar\'s tick label font'
@@ -107519,6 +107528,7 @@ function mockColorBarAxis(gd, opts, zrange) {
107519
107528
  showticklabels: opts.showticklabels,
107520
107529
  ticklabelposition: opts.ticklabelposition,
107521
107530
  ticklabeloverflow: opts.ticklabeloverflow,
107531
+ ticklabelstep: opts.ticklabelstep,
107522
107532
  tickfont: opts.tickfont,
107523
107533
  tickangle: opts.tickangle,
107524
107534
  tickformat: opts.tickformat,
@@ -116815,7 +116825,6 @@ function computeLegendDimensions(gd, groups, traces, legendObj) {
116815
116825
  offsetY += h;
116816
116826
  maxWidthInGroup = Math.max(maxWidthInGroup, textGap + w);
116817
116827
  });
116818
- maxGroupHeightInRow = Math.max(maxGroupHeightInRow, offsetY);
116819
116828
 
116820
116829
  var next = maxWidthInGroup + itemGap;
116821
116830
 
@@ -116831,6 +116840,8 @@ function computeLegendDimensions(gd, groups, traces, legendObj) {
116831
116840
  groupOffsetX = 0;
116832
116841
  groupOffsetY += maxGroupHeightInRow + traceGroupGap;
116833
116842
  maxGroupHeightInRow = offsetY;
116843
+ } else {
116844
+ maxGroupHeightInRow = Math.max(maxGroupHeightInRow, offsetY);
116834
116845
  }
116835
116846
 
116836
116847
  Drawing.setTranslate(this, groupOffsetX, groupOffsetY);
@@ -119334,6 +119345,8 @@ var isNumeric = _dereq_('fast-isnumeric');
119334
119345
 
119335
119346
  var Lib = _dereq_('../../lib');
119336
119347
  var Icons = _dereq_('../../fonts/ploticon');
119348
+ var version = _dereq_('../../version').version;
119349
+
119337
119350
  var Parser = new DOMParser();
119338
119351
 
119339
119352
  /**
@@ -119612,6 +119625,10 @@ proto.hasButtons = function(buttons) {
119612
119625
  return true;
119613
119626
  };
119614
119627
 
119628
+ function jsVersion(str) {
119629
+ return str + ' (v' + version + ')';
119630
+ }
119631
+
119615
119632
  /**
119616
119633
  * @return {HTMLDivElement} The logo image wrapped in a group
119617
119634
  */
@@ -119621,7 +119638,7 @@ proto.getLogo = function() {
119621
119638
 
119622
119639
  a.href = 'https://plotly.com/';
119623
119640
  a.target = '_blank';
119624
- a.setAttribute('data-title', Lib._(this.graphInfo, 'Produced with Plotly'));
119641
+ a.setAttribute('data-title', jsVersion(Lib._(this.graphInfo, 'Produced with Plotly.js')));
119625
119642
  a.className = 'modebar-btn plotlyjsicon modebar-btn--logo';
119626
119643
 
119627
119644
  a.appendChild(this.createIcon(Icons.newplotlylogo));
@@ -119663,7 +119680,7 @@ function createModeBar(gd, buttons) {
119663
119680
 
119664
119681
  module.exports = createModeBar;
119665
119682
 
119666
- },{"../../fonts/ploticon":482,"../../lib":503,"@plotly/d3":58,"fast-isnumeric":190}],432:[function(_dereq_,module,exports){
119683
+ },{"../../fonts/ploticon":482,"../../lib":503,"../../version":1119,"@plotly/d3":58,"fast-isnumeric":190}],432:[function(_dereq_,module,exports){
119667
119684
  'use strict';
119668
119685
 
119669
119686
  var fontAttrs = _dereq_('../../plots/font_attributes');
@@ -144809,7 +144826,8 @@ axes.calcTicks = function calcTicks(ax, opts) {
144809
144826
  var minRange = Math.min(rng[0], rng[1]);
144810
144827
  var maxRange = Math.max(rng[0], rng[1]);
144811
144828
 
144812
- var isDLog = (ax.type === 'log') && !(isNumeric(ax.dtick) || ax.dtick.charAt(0) === 'L');
144829
+ var numDtick = isNumeric(ax.dtick);
144830
+ var isDLog = (ax.type === 'log') && !(numDtick || ax.dtick.charAt(0) === 'L');
144813
144831
  var isPeriod = ax.ticklabelmode === 'period';
144814
144832
 
144815
144833
  // find the first tick
@@ -144840,13 +144858,36 @@ axes.calcTicks = function calcTicks(ax, opts) {
144840
144858
  x = axes.tickIncrement(x, ax.dtick, !axrev, ax.calendar);
144841
144859
  }
144842
144860
 
144861
+ var ticklabelstep = ax.ticklabelstep;
144862
+
144843
144863
  var maxTicks = Math.max(1000, ax._length || 0);
144844
144864
  var tickVals = [];
144845
144865
  var xPrevious = null;
144866
+
144867
+ var dTick;
144868
+ if(numDtick) {
144869
+ dTick = ax.dtick;
144870
+ } else {
144871
+ if(ax.type === 'date') {
144872
+ if(typeof ax.dtick === 'string' && ax.dtick.charAt(0) === 'M') {
144873
+ dTick = ONEAVGMONTH * ax.dtick.substring(1);
144874
+ }
144875
+ } else {
144876
+ dTick = ax._roughDTick;
144877
+ }
144878
+ }
144879
+
144880
+ var id = Math.round((
144881
+ ax.r2l(x) -
144882
+ ax.r2l(ax.tick0)
144883
+ ) / dTick) - 1;
144884
+
144846
144885
  for(;
144847
144886
  (axrev) ? (x >= endTick) : (x <= endTick);
144848
144887
  x = axes.tickIncrement(x, ax.dtick, axrev, ax.calendar)
144849
144888
  ) {
144889
+ id++;
144890
+
144850
144891
  if(ax.rangebreaks) {
144851
144892
  if(!axrev) {
144852
144893
  if(x < startTick) continue;
@@ -144864,10 +144905,16 @@ axes.calcTicks = function calcTicks(ax, opts) {
144864
144905
  minor = true;
144865
144906
  }
144866
144907
 
144867
- tickVals.push({
144908
+ var obj = {
144868
144909
  minor: minor,
144869
144910
  value: x
144870
- });
144911
+ };
144912
+
144913
+ if(ticklabelstep > 1 && id % ticklabelstep) {
144914
+ obj.skipLabel = true;
144915
+ }
144916
+
144917
+ tickVals.push(obj);
144871
144918
  }
144872
144919
 
144873
144920
  if(isPeriod) positionPeriodTicks(tickVals, ax, ax._definedDelta);
@@ -144920,12 +144967,20 @@ axes.calcTicks = function calcTicks(ax, opts) {
144920
144967
  ax._prevDateHead = '';
144921
144968
  ax._inCalcTicks = true;
144922
144969
 
144970
+ var lastVisibleHead;
144971
+ var hideLabel = function(tick) {
144972
+ tick.text = ' '; // don't use an empty string here which can confuse automargin (issue 5132)
144973
+ ax._prevDateHead = lastVisibleHead;
144974
+ };
144975
+
144923
144976
  var ticksOut = [];
144924
144977
  var t, p;
144925
144978
  for(i = 0; i < tickVals.length; i++) {
144926
144979
  var _minor = tickVals[i].minor;
144927
144980
  var _value = tickVals[i].value;
144928
144981
 
144982
+ lastVisibleHead = ax._prevDateHead;
144983
+
144929
144984
  t = axes.tickText(
144930
144985
  ax,
144931
144986
  _value,
@@ -144940,11 +144995,14 @@ axes.calcTicks = function calcTicks(ax, opts) {
144940
144995
  if(p > maxRange) t.periodX = maxRange;
144941
144996
  if(p < minRange) t.periodX = minRange;
144942
144997
 
144943
- t.text = ' '; // don't use an empty string here which can confuse automargin (issue 5132)
144944
- ax._prevDateHead = '';
144998
+ hideLabel(t);
144945
144999
  }
144946
145000
  }
144947
145001
 
145002
+ if(tickVals[i].skipLabel) {
145003
+ hideLabel(t);
145004
+ }
145005
+
144948
145006
  ticksOut.push(t);
144949
145007
  }
144950
145008
 
@@ -146972,6 +147030,7 @@ axes.drawLabels = function(gd, ax, opts) {
146972
147030
  var axId = ax._id;
146973
147031
  var axLetter = axId.charAt(0);
146974
147032
  var cls = opts.cls || axId + 'tick';
147033
+
146975
147034
  var vals = opts.vals;
146976
147035
 
146977
147036
  var labelFns = opts.labelFns;
@@ -152033,6 +152092,20 @@ module.exports = {
152033
152092
  'To set ticks every 4 years, set `dtick` to *M48*'
152034
152093
  ].join(' ')
152035
152094
  },
152095
+ ticklabelstep: {
152096
+ valType: 'integer',
152097
+ min: 1,
152098
+ dflt: 1,
152099
+ editType: 'ticks',
152100
+ description: [
152101
+ 'Sets the spacing between tick labels as compared to the spacing between ticks.',
152102
+ 'A value of 1 (default) means each tick gets a label.',
152103
+ 'A value of 2 means shows every 2nd label.',
152104
+ 'A larger value n means only every nth tick is labeled.',
152105
+ '`tick0` determines which labels are shown.',
152106
+ 'Not implemented for axes with `type` *log* or *multicategory*, or when `tickmode` is *array*.'
152107
+ ].join(' ')
152108
+ },
152036
152109
  tickvals: {
152037
152110
  valType: 'data_array',
152038
152111
  editType: 'ticks',
@@ -155130,6 +155203,14 @@ module.exports = function handleTickLabelDefaults(containerIn, containerOut, coe
155130
155203
  color: dfltFontColor
155131
155204
  });
155132
155205
 
155206
+ if(
155207
+ !options.noTicklabelstep &&
155208
+ axType !== 'multicategory' &&
155209
+ axType !== 'log'
155210
+ ) {
155211
+ coerce('ticklabelstep');
155212
+ }
155213
+
155133
155214
  if(!options.noAng) coerce('tickangle');
155134
155215
 
155135
155216
  if(axType !== 'category') {
@@ -160256,6 +160337,7 @@ module.exports = function supplyLayoutDefaults(layoutIn, layoutOut, options) {
160256
160337
  showGrid: true,
160257
160338
  noTickson: true,
160258
160339
  noTicklabelmode: true,
160340
+ noTicklabelstep: true,
160259
160341
  noTicklabelposition: true,
160260
160342
  noTicklabeloverflow: true,
160261
160343
  bgColor: options.bgColor,
@@ -168522,6 +168604,7 @@ var axisTickAttrs = overrideAll({
168522
168604
  ticklen: axesAttrs.ticklen,
168523
168605
  tickwidth: axesAttrs.tickwidth,
168524
168606
  tickcolor: axesAttrs.tickcolor,
168607
+ ticklabelstep: axesAttrs.ticklabelstep,
168525
168608
  showticklabels: axesAttrs.showticklabels,
168526
168609
  showtickprefix: axesAttrs.showtickprefix,
168527
168610
  tickprefix: axesAttrs.tickprefix,
@@ -171175,6 +171258,7 @@ function handleDefaults(contIn, contOut, coerce, opts) {
171175
171258
  }
171176
171259
 
171177
171260
  handleTickLabelDefaults(axIn, axOut, coerceAxis, axOut.type, {
171261
+ noTicklabelstep: true,
171178
171262
  noAng: !isRealAxis,
171179
171263
  noExp: true,
171180
171264
  font: {
@@ -171519,6 +171603,7 @@ var ternaryAxesAttrs = {
171519
171603
  ticklen: axesAttrs.ticklen,
171520
171604
  tickwidth: axesAttrs.tickwidth,
171521
171605
  tickcolor: axesAttrs.tickcolor,
171606
+ ticklabelstep: axesAttrs.ticklabelstep,
171522
171607
  showticklabels: axesAttrs.showticklabels,
171523
171608
  showtickprefix: axesAttrs.showtickprefix,
171524
171609
  tickprefix: axesAttrs.tickprefix,
@@ -176118,12 +176203,14 @@ function calcTexttemplate(fullLayout, cd, index, xa, ya) {
176118
176203
  var trace = cd[0].trace;
176119
176204
  var texttemplate = Lib.castOption(trace, index, 'texttemplate');
176120
176205
  if(!texttemplate) return '';
176206
+ var isHistogram = (trace.type === 'histogram');
176121
176207
  var isWaterfall = (trace.type === 'waterfall');
176122
176208
  var isFunnel = (trace.type === 'funnel');
176209
+ var isHorizontal = trace.orientation === 'h';
176123
176210
 
176124
176211
  var pLetter, pAxis;
176125
176212
  var vLetter, vAxis;
176126
- if(trace.orientation === 'h') {
176213
+ if(isHorizontal) {
176127
176214
  pLetter = 'y';
176128
176215
  pAxis = ya;
176129
176216
  vLetter = 'x';
@@ -176158,6 +176245,11 @@ function calcTexttemplate(fullLayout, cd, index, xa, ya) {
176158
176245
  var pt = {};
176159
176246
  appendArrayPointValue(pt, trace, cdi.i);
176160
176247
 
176248
+ if(isHistogram || pt.x === undefined) pt.x = isHorizontal ? obj.value : obj.label;
176249
+ if(isHistogram || pt.y === undefined) pt.y = isHorizontal ? obj.label : obj.value;
176250
+ if(isHistogram || pt.xLabel === undefined) pt.xLabel = isHorizontal ? obj.valueLabel : obj.labelLabel;
176251
+ if(isHistogram || pt.yLabel === undefined) pt.yLabel = isHorizontal ? obj.labelLabel : obj.valueLabel;
176252
+
176161
176253
  if(isWaterfall) {
176162
176254
  obj.delta = +cdi.rawS || cdi.s;
176163
176255
  obj.deltaLabel = formatNumber(obj.delta);
@@ -179706,6 +179798,7 @@ function mimickAxisDefaults(traceIn, traceOut, fullLayout, dfltColor) {
179706
179798
  var axOut = Template.newContainer(traceOut, axName);
179707
179799
 
179708
179800
  var defaultOptions = {
179801
+ noTicklabelstep: true,
179709
179802
  tickfont: 'x',
179710
179803
  id: axLetter + 'axis',
179711
179804
  letter: axLetter,
@@ -190924,6 +191017,7 @@ module.exports = function(gd, plotinfo, cdheatmaps, heatmapLayer) {
190924
191017
  var font = trace.textfont;
190925
191018
  var fontFamily = font.family;
190926
191019
  var fontSize = font.size;
191020
+ var globalFontSize = gd._fullLayout.font.size;
190927
191021
 
190928
191022
  if(!fontSize || fontSize === 'auto') {
190929
191023
  var minW = Infinity;
@@ -190950,7 +191044,7 @@ module.exports = function(gd, plotinfo, cdheatmaps, heatmapLayer) {
190950
191044
  !isFinite(minW) ||
190951
191045
  !isFinite(minH)
190952
191046
  ) {
190953
- fontSize = 12;
191047
+ fontSize = globalFontSize;
190954
191048
  } else {
190955
191049
  minW -= xGap;
190956
191050
  minH -= yGap;
@@ -190963,7 +191057,8 @@ module.exports = function(gd, plotinfo, cdheatmaps, heatmapLayer) {
190963
191057
 
190964
191058
  fontSize = Math.min(
190965
191059
  Math.floor(minW),
190966
- Math.floor(minH)
191060
+ Math.floor(minH),
191061
+ globalFontSize
190967
191062
  );
190968
191063
  }
190969
191064
  }
@@ -192004,8 +192099,9 @@ var getBinSpanLabelRound = _dereq_('./bin_label_vals');
192004
192099
  function calc(gd, trace) {
192005
192100
  var pos = [];
192006
192101
  var size = [];
192007
- var pa = Axes.getFromId(gd, trace.orientation === 'h' ? trace.yaxis : trace.xaxis);
192008
- var mainData = trace.orientation === 'h' ? 'y' : 'x';
192102
+ var isHorizontal = trace.orientation === 'h';
192103
+ var pa = Axes.getFromId(gd, isHorizontal ? trace.yaxis : trace.xaxis);
192104
+ var mainData = isHorizontal ? 'y' : 'x';
192009
192105
  var counterData = {x: 'y', y: 'x'}[mainData];
192010
192106
  var calendar = trace[mainData + 'calendar'];
192011
192107
  var cumulativeSpec = trace.cumulative;
@@ -195224,6 +195320,7 @@ module.exports = {
195224
195320
  ticklen: axesAttrs.ticklen,
195225
195321
  tickwidth: axesAttrs.tickwidth,
195226
195322
  tickcolor: axesAttrs.tickcolor,
195323
+ ticklabelstep: axesAttrs.ticklabelstep,
195227
195324
  showticklabels: axesAttrs.showticklabels,
195228
195325
  tickfont: fontAttrs({
195229
195326
  description: 'Sets the color bar\'s tick label font'
@@ -230510,7 +230607,7 @@ function getSortFunc(opts, d2c) {
230510
230607
  'use strict';
230511
230608
 
230512
230609
  // package version injected by `npm run preprocess`
230513
- exports.version = '2.8.0';
230610
+ exports.version = '2.9.0';
230514
230611
 
230515
230612
  },{}],1120:[function(_dereq_,module,exports){
230516
230613
  (function (global){(function (){