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 (basic) v2.8.0
3
- * Copyright 2012-2021, Plotly, Inc.
2
+ * plotly.js (basic) v2.9.0
3
+ * Copyright 2012-2022, Plotly, Inc.
4
4
  * All rights reserved.
5
5
  * Licensed under the MIT license
6
6
  */
@@ -21660,6 +21660,7 @@ module.exports = overrideAll({
21660
21660
  ticklen: axesAttrs.ticklen,
21661
21661
  tickwidth: axesAttrs.tickwidth,
21662
21662
  tickcolor: axesAttrs.tickcolor,
21663
+ ticklabelstep: axesAttrs.ticklabelstep,
21663
21664
  showticklabels: axesAttrs.showticklabels,
21664
21665
  tickfont: fontAttrs({
21665
21666
  }),
@@ -22750,6 +22751,7 @@ function mockColorBarAxis(gd, opts, zrange) {
22750
22751
  showticklabels: opts.showticklabels,
22751
22752
  ticklabelposition: opts.ticklabelposition,
22752
22753
  ticklabeloverflow: opts.ticklabeloverflow,
22754
+ ticklabelstep: opts.ticklabelstep,
22753
22755
  tickfont: opts.tickfont,
22754
22756
  tickangle: opts.tickangle,
22755
22757
  tickformat: opts.tickformat,
@@ -31556,7 +31558,6 @@ function computeLegendDimensions(gd, groups, traces, legendObj) {
31556
31558
  offsetY += h;
31557
31559
  maxWidthInGroup = Math.max(maxWidthInGroup, textGap + w);
31558
31560
  });
31559
- maxGroupHeightInRow = Math.max(maxGroupHeightInRow, offsetY);
31560
31561
 
31561
31562
  var next = maxWidthInGroup + itemGap;
31562
31563
 
@@ -31572,6 +31573,8 @@ function computeLegendDimensions(gd, groups, traces, legendObj) {
31572
31573
  groupOffsetX = 0;
31573
31574
  groupOffsetY += maxGroupHeightInRow + traceGroupGap;
31574
31575
  maxGroupHeightInRow = offsetY;
31576
+ } else {
31577
+ maxGroupHeightInRow = Math.max(maxGroupHeightInRow, offsetY);
31575
31578
  }
31576
31579
 
31577
31580
  Drawing.setTranslate(this, groupOffsetX, groupOffsetY);
@@ -34054,6 +34057,8 @@ var isNumeric = _dereq_('fast-isnumeric');
34054
34057
 
34055
34058
  var Lib = _dereq_('../../lib');
34056
34059
  var Icons = _dereq_('../../fonts/ploticon');
34060
+ var version = _dereq_('../../version').version;
34061
+
34057
34062
  var Parser = new DOMParser();
34058
34063
 
34059
34064
  /**
@@ -34332,6 +34337,10 @@ proto.hasButtons = function(buttons) {
34332
34337
  return true;
34333
34338
  };
34334
34339
 
34340
+ function jsVersion(str) {
34341
+ return str + ' (v' + version + ')';
34342
+ }
34343
+
34335
34344
  /**
34336
34345
  * @return {HTMLDivElement} The logo image wrapped in a group
34337
34346
  */
@@ -34341,7 +34350,7 @@ proto.getLogo = function() {
34341
34350
 
34342
34351
  a.href = 'https://plotly.com/';
34343
34352
  a.target = '_blank';
34344
- a.setAttribute('data-title', Lib._(this.graphInfo, 'Produced with Plotly'));
34353
+ a.setAttribute('data-title', jsVersion(Lib._(this.graphInfo, 'Produced with Plotly.js')));
34345
34354
  a.className = 'modebar-btn plotlyjsicon modebar-btn--logo';
34346
34355
 
34347
34356
  a.appendChild(this.createIcon(Icons.newplotlylogo));
@@ -34383,7 +34392,7 @@ function createModeBar(gd, buttons) {
34383
34392
 
34384
34393
  module.exports = createModeBar;
34385
34394
 
34386
- },{"../../fonts/ploticon":215,"../../lib":232,"@plotly/d3":11,"fast-isnumeric":17}],168:[function(_dereq_,module,exports){
34395
+ },{"../../fonts/ploticon":215,"../../lib":232,"../../version":391,"@plotly/d3":11,"fast-isnumeric":17}],168:[function(_dereq_,module,exports){
34387
34396
  'use strict';
34388
34397
 
34389
34398
  var fontAttrs = _dereq_('../../plots/font_attributes');
@@ -57776,7 +57785,8 @@ axes.calcTicks = function calcTicks(ax, opts) {
57776
57785
  var minRange = Math.min(rng[0], rng[1]);
57777
57786
  var maxRange = Math.max(rng[0], rng[1]);
57778
57787
 
57779
- var isDLog = (ax.type === 'log') && !(isNumeric(ax.dtick) || ax.dtick.charAt(0) === 'L');
57788
+ var numDtick = isNumeric(ax.dtick);
57789
+ var isDLog = (ax.type === 'log') && !(numDtick || ax.dtick.charAt(0) === 'L');
57780
57790
  var isPeriod = ax.ticklabelmode === 'period';
57781
57791
 
57782
57792
  // find the first tick
@@ -57807,13 +57817,36 @@ axes.calcTicks = function calcTicks(ax, opts) {
57807
57817
  x = axes.tickIncrement(x, ax.dtick, !axrev, ax.calendar);
57808
57818
  }
57809
57819
 
57820
+ var ticklabelstep = ax.ticklabelstep;
57821
+
57810
57822
  var maxTicks = Math.max(1000, ax._length || 0);
57811
57823
  var tickVals = [];
57812
57824
  var xPrevious = null;
57825
+
57826
+ var dTick;
57827
+ if(numDtick) {
57828
+ dTick = ax.dtick;
57829
+ } else {
57830
+ if(ax.type === 'date') {
57831
+ if(typeof ax.dtick === 'string' && ax.dtick.charAt(0) === 'M') {
57832
+ dTick = ONEAVGMONTH * ax.dtick.substring(1);
57833
+ }
57834
+ } else {
57835
+ dTick = ax._roughDTick;
57836
+ }
57837
+ }
57838
+
57839
+ var id = Math.round((
57840
+ ax.r2l(x) -
57841
+ ax.r2l(ax.tick0)
57842
+ ) / dTick) - 1;
57843
+
57813
57844
  for(;
57814
57845
  (axrev) ? (x >= endTick) : (x <= endTick);
57815
57846
  x = axes.tickIncrement(x, ax.dtick, axrev, ax.calendar)
57816
57847
  ) {
57848
+ id++;
57849
+
57817
57850
  if(ax.rangebreaks) {
57818
57851
  if(!axrev) {
57819
57852
  if(x < startTick) continue;
@@ -57831,10 +57864,16 @@ axes.calcTicks = function calcTicks(ax, opts) {
57831
57864
  minor = true;
57832
57865
  }
57833
57866
 
57834
- tickVals.push({
57867
+ var obj = {
57835
57868
  minor: minor,
57836
57869
  value: x
57837
- });
57870
+ };
57871
+
57872
+ if(ticklabelstep > 1 && id % ticklabelstep) {
57873
+ obj.skipLabel = true;
57874
+ }
57875
+
57876
+ tickVals.push(obj);
57838
57877
  }
57839
57878
 
57840
57879
  if(isPeriod) positionPeriodTicks(tickVals, ax, ax._definedDelta);
@@ -57887,12 +57926,20 @@ axes.calcTicks = function calcTicks(ax, opts) {
57887
57926
  ax._prevDateHead = '';
57888
57927
  ax._inCalcTicks = true;
57889
57928
 
57929
+ var lastVisibleHead;
57930
+ var hideLabel = function(tick) {
57931
+ tick.text = ' '; // don't use an empty string here which can confuse automargin (issue 5132)
57932
+ ax._prevDateHead = lastVisibleHead;
57933
+ };
57934
+
57890
57935
  var ticksOut = [];
57891
57936
  var t, p;
57892
57937
  for(i = 0; i < tickVals.length; i++) {
57893
57938
  var _minor = tickVals[i].minor;
57894
57939
  var _value = tickVals[i].value;
57895
57940
 
57941
+ lastVisibleHead = ax._prevDateHead;
57942
+
57896
57943
  t = axes.tickText(
57897
57944
  ax,
57898
57945
  _value,
@@ -57907,11 +57954,14 @@ axes.calcTicks = function calcTicks(ax, opts) {
57907
57954
  if(p > maxRange) t.periodX = maxRange;
57908
57955
  if(p < minRange) t.periodX = minRange;
57909
57956
 
57910
- t.text = ' '; // don't use an empty string here which can confuse automargin (issue 5132)
57911
- ax._prevDateHead = '';
57957
+ hideLabel(t);
57912
57958
  }
57913
57959
  }
57914
57960
 
57961
+ if(tickVals[i].skipLabel) {
57962
+ hideLabel(t);
57963
+ }
57964
+
57915
57965
  ticksOut.push(t);
57916
57966
  }
57917
57967
 
@@ -59939,6 +59989,7 @@ axes.drawLabels = function(gd, ax, opts) {
59939
59989
  var axId = ax._id;
59940
59990
  var axLetter = axId.charAt(0);
59941
59991
  var cls = opts.cls || axId + 'tick';
59992
+
59942
59993
  var vals = opts.vals;
59943
59994
 
59944
59995
  var labelFns = opts.labelFns;
@@ -64795,6 +64846,12 @@ module.exports = {
64795
64846
  editType: 'ticks',
64796
64847
  impliedEdits: {tickmode: 'linear'},
64797
64848
  },
64849
+ ticklabelstep: {
64850
+ valType: 'integer',
64851
+ min: 1,
64852
+ dflt: 1,
64853
+ editType: 'ticks',
64854
+ },
64798
64855
  tickvals: {
64799
64856
  valType: 'data_array',
64800
64857
  editType: 'ticks',
@@ -67659,6 +67716,14 @@ module.exports = function handleTickLabelDefaults(containerIn, containerOut, coe
67659
67716
  color: dfltFontColor
67660
67717
  });
67661
67718
 
67719
+ if(
67720
+ !options.noTicklabelstep &&
67721
+ axType !== 'multicategory' &&
67722
+ axType !== 'log'
67723
+ ) {
67724
+ coerce('ticklabelstep');
67725
+ }
67726
+
67662
67727
  if(!options.noAng) coerce('tickangle');
67663
67728
 
67664
67729
  if(axType !== 'category') {
@@ -76122,12 +76187,14 @@ function calcTexttemplate(fullLayout, cd, index, xa, ya) {
76122
76187
  var trace = cd[0].trace;
76123
76188
  var texttemplate = Lib.castOption(trace, index, 'texttemplate');
76124
76189
  if(!texttemplate) return '';
76190
+ var isHistogram = (trace.type === 'histogram');
76125
76191
  var isWaterfall = (trace.type === 'waterfall');
76126
76192
  var isFunnel = (trace.type === 'funnel');
76193
+ var isHorizontal = trace.orientation === 'h';
76127
76194
 
76128
76195
  var pLetter, pAxis;
76129
76196
  var vLetter, vAxis;
76130
- if(trace.orientation === 'h') {
76197
+ if(isHorizontal) {
76131
76198
  pLetter = 'y';
76132
76199
  pAxis = ya;
76133
76200
  vLetter = 'x';
@@ -76162,6 +76229,11 @@ function calcTexttemplate(fullLayout, cd, index, xa, ya) {
76162
76229
  var pt = {};
76163
76230
  appendArrayPointValue(pt, trace, cdi.i);
76164
76231
 
76232
+ if(isHistogram || pt.x === undefined) pt.x = isHorizontal ? obj.value : obj.label;
76233
+ if(isHistogram || pt.y === undefined) pt.y = isHorizontal ? obj.label : obj.value;
76234
+ if(isHistogram || pt.xLabel === undefined) pt.xLabel = isHorizontal ? obj.valueLabel : obj.labelLabel;
76235
+ if(isHistogram || pt.yLabel === undefined) pt.yLabel = isHorizontal ? obj.labelLabel : obj.valueLabel;
76236
+
76165
76237
  if(isWaterfall) {
76166
76238
  obj.delta = +cdi.rawS || cdi.s;
76167
76239
  obj.deltaLabel = formatNumber(obj.delta);
@@ -82624,7 +82696,7 @@ function getSortFunc(opts, d2c) {
82624
82696
  'use strict';
82625
82697
 
82626
82698
  // package version injected by `npm run preprocess`
82627
- exports.version = '2.8.0';
82699
+ exports.version = '2.9.0';
82628
82700
 
82629
82701
  },{}]},{},[8])(8)
82630
82702
  });