plotly.js 2.8.3 → 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 (74) hide show
  1. package/.circleci/env_image.sh +1 -1
  2. package/CHANGELOG.md +13 -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 +76 -11
  7. package/dist/plotly-basic.min.js +5 -5
  8. package/dist/plotly-cartesian.js +86 -12
  9. package/dist/plotly-cartesian.min.js +3 -3
  10. package/dist/plotly-finance.js +77 -11
  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 +76 -11
  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 +90 -12
  38. package/dist/plotly-strict.min.js +3 -3
  39. package/dist/plotly-with-meta.js +99 -12
  40. package/dist/plotly.js +91 -12
  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/carpet/ab_defaults.js +1 -0
  72. package/src/traces/indicator/attributes.js +1 -0
  73. package/src/version.js +1 -1
  74. package/.vscode/launch.json +0 -0
@@ -1,6 +1,6 @@
1
1
  /**
2
- * plotly.js (cartesian) v2.8.3
3
- * Copyright 2012-2021, Plotly, Inc.
2
+ * plotly.js (cartesian) v2.9.0
3
+ * Copyright 2012-2022, Plotly, Inc.
4
4
  * All rights reserved.
5
5
  * Licensed under the MIT license
6
6
  */
@@ -15724,7 +15724,15 @@ exports.readUInt32BE = function (data, offset) {
15724
15724
 
15725
15725
  function ProbeError(message, code, statusCode) {
15726
15726
  Error.call(this);
15727
- Error.captureStackTrace(this, this.constructor);
15727
+
15728
+ // Include stack trace in error object
15729
+ if (Error.captureStackTrace) {
15730
+ // Chrome and NodeJS
15731
+ Error.captureStackTrace(this, this.constructor);
15732
+ } else {
15733
+ // FF, IE 10+ and Safari 6+. Fallback for others
15734
+ this.stack = (new Error()).stack || '';
15735
+ }
15728
15736
 
15729
15737
  this.name = this.constructor.name;
15730
15738
 
@@ -30822,6 +30830,7 @@ module.exports = overrideAll({
30822
30830
  ticklen: axesAttrs.ticklen,
30823
30831
  tickwidth: axesAttrs.tickwidth,
30824
30832
  tickcolor: axesAttrs.tickcolor,
30833
+ ticklabelstep: axesAttrs.ticklabelstep,
30825
30834
  showticklabels: axesAttrs.showticklabels,
30826
30835
  tickfont: fontAttrs({
30827
30836
  }),
@@ -31912,6 +31921,7 @@ function mockColorBarAxis(gd, opts, zrange) {
31912
31921
  showticklabels: opts.showticklabels,
31913
31922
  ticklabelposition: opts.ticklabelposition,
31914
31923
  ticklabeloverflow: opts.ticklabeloverflow,
31924
+ ticklabelstep: opts.ticklabelstep,
31915
31925
  tickfont: opts.tickfont,
31916
31926
  tickangle: opts.tickangle,
31917
31927
  tickformat: opts.tickformat,
@@ -40718,7 +40728,6 @@ function computeLegendDimensions(gd, groups, traces, legendObj) {
40718
40728
  offsetY += h;
40719
40729
  maxWidthInGroup = Math.max(maxWidthInGroup, textGap + w);
40720
40730
  });
40721
- maxGroupHeightInRow = Math.max(maxGroupHeightInRow, offsetY);
40722
40731
 
40723
40732
  var next = maxWidthInGroup + itemGap;
40724
40733
 
@@ -40734,6 +40743,8 @@ function computeLegendDimensions(gd, groups, traces, legendObj) {
40734
40743
  groupOffsetX = 0;
40735
40744
  groupOffsetY += maxGroupHeightInRow + traceGroupGap;
40736
40745
  maxGroupHeightInRow = offsetY;
40746
+ } else {
40747
+ maxGroupHeightInRow = Math.max(maxGroupHeightInRow, offsetY);
40737
40748
  }
40738
40749
 
40739
40750
  Drawing.setTranslate(this, groupOffsetX, groupOffsetY);
@@ -43216,6 +43227,8 @@ var isNumeric = _dereq_('fast-isnumeric');
43216
43227
 
43217
43228
  var Lib = _dereq_('../../lib');
43218
43229
  var Icons = _dereq_('../../fonts/ploticon');
43230
+ var version = _dereq_('../../version').version;
43231
+
43219
43232
  var Parser = new DOMParser();
43220
43233
 
43221
43234
  /**
@@ -43494,6 +43507,10 @@ proto.hasButtons = function(buttons) {
43494
43507
  return true;
43495
43508
  };
43496
43509
 
43510
+ function jsVersion(str) {
43511
+ return str + ' (v' + version + ')';
43512
+ }
43513
+
43497
43514
  /**
43498
43515
  * @return {HTMLDivElement} The logo image wrapped in a group
43499
43516
  */
@@ -43503,7 +43520,7 @@ proto.getLogo = function() {
43503
43520
 
43504
43521
  a.href = 'https://plotly.com/';
43505
43522
  a.target = '_blank';
43506
- a.setAttribute('data-title', Lib._(this.graphInfo, 'Produced with Plotly'));
43523
+ a.setAttribute('data-title', jsVersion(Lib._(this.graphInfo, 'Produced with Plotly.js')));
43507
43524
  a.className = 'modebar-btn plotlyjsicon modebar-btn--logo';
43508
43525
 
43509
43526
  a.appendChild(this.createIcon(Icons.newplotlylogo));
@@ -43545,7 +43562,7 @@ function createModeBar(gd, buttons) {
43545
43562
 
43546
43563
  module.exports = createModeBar;
43547
43564
 
43548
- },{"../../fonts/ploticon":270,"../../lib":287,"@plotly/d3":20,"fast-isnumeric":33}],223:[function(_dereq_,module,exports){
43565
+ },{"../../fonts/ploticon":270,"../../lib":287,"../../version":552,"@plotly/d3":20,"fast-isnumeric":33}],223:[function(_dereq_,module,exports){
43549
43566
  'use strict';
43550
43567
 
43551
43568
  var fontAttrs = _dereq_('../../plots/font_attributes');
@@ -66938,7 +66955,8 @@ axes.calcTicks = function calcTicks(ax, opts) {
66938
66955
  var minRange = Math.min(rng[0], rng[1]);
66939
66956
  var maxRange = Math.max(rng[0], rng[1]);
66940
66957
 
66941
- var isDLog = (ax.type === 'log') && !(isNumeric(ax.dtick) || ax.dtick.charAt(0) === 'L');
66958
+ var numDtick = isNumeric(ax.dtick);
66959
+ var isDLog = (ax.type === 'log') && !(numDtick || ax.dtick.charAt(0) === 'L');
66942
66960
  var isPeriod = ax.ticklabelmode === 'period';
66943
66961
 
66944
66962
  // find the first tick
@@ -66969,13 +66987,36 @@ axes.calcTicks = function calcTicks(ax, opts) {
66969
66987
  x = axes.tickIncrement(x, ax.dtick, !axrev, ax.calendar);
66970
66988
  }
66971
66989
 
66990
+ var ticklabelstep = ax.ticklabelstep;
66991
+
66972
66992
  var maxTicks = Math.max(1000, ax._length || 0);
66973
66993
  var tickVals = [];
66974
66994
  var xPrevious = null;
66995
+
66996
+ var dTick;
66997
+ if(numDtick) {
66998
+ dTick = ax.dtick;
66999
+ } else {
67000
+ if(ax.type === 'date') {
67001
+ if(typeof ax.dtick === 'string' && ax.dtick.charAt(0) === 'M') {
67002
+ dTick = ONEAVGMONTH * ax.dtick.substring(1);
67003
+ }
67004
+ } else {
67005
+ dTick = ax._roughDTick;
67006
+ }
67007
+ }
67008
+
67009
+ var id = Math.round((
67010
+ ax.r2l(x) -
67011
+ ax.r2l(ax.tick0)
67012
+ ) / dTick) - 1;
67013
+
66975
67014
  for(;
66976
67015
  (axrev) ? (x >= endTick) : (x <= endTick);
66977
67016
  x = axes.tickIncrement(x, ax.dtick, axrev, ax.calendar)
66978
67017
  ) {
67018
+ id++;
67019
+
66979
67020
  if(ax.rangebreaks) {
66980
67021
  if(!axrev) {
66981
67022
  if(x < startTick) continue;
@@ -66993,10 +67034,16 @@ axes.calcTicks = function calcTicks(ax, opts) {
66993
67034
  minor = true;
66994
67035
  }
66995
67036
 
66996
- tickVals.push({
67037
+ var obj = {
66997
67038
  minor: minor,
66998
67039
  value: x
66999
- });
67040
+ };
67041
+
67042
+ if(ticklabelstep > 1 && id % ticklabelstep) {
67043
+ obj.skipLabel = true;
67044
+ }
67045
+
67046
+ tickVals.push(obj);
67000
67047
  }
67001
67048
 
67002
67049
  if(isPeriod) positionPeriodTicks(tickVals, ax, ax._definedDelta);
@@ -67049,12 +67096,20 @@ axes.calcTicks = function calcTicks(ax, opts) {
67049
67096
  ax._prevDateHead = '';
67050
67097
  ax._inCalcTicks = true;
67051
67098
 
67099
+ var lastVisibleHead;
67100
+ var hideLabel = function(tick) {
67101
+ tick.text = ' '; // don't use an empty string here which can confuse automargin (issue 5132)
67102
+ ax._prevDateHead = lastVisibleHead;
67103
+ };
67104
+
67052
67105
  var ticksOut = [];
67053
67106
  var t, p;
67054
67107
  for(i = 0; i < tickVals.length; i++) {
67055
67108
  var _minor = tickVals[i].minor;
67056
67109
  var _value = tickVals[i].value;
67057
67110
 
67111
+ lastVisibleHead = ax._prevDateHead;
67112
+
67058
67113
  t = axes.tickText(
67059
67114
  ax,
67060
67115
  _value,
@@ -67069,11 +67124,14 @@ axes.calcTicks = function calcTicks(ax, opts) {
67069
67124
  if(p > maxRange) t.periodX = maxRange;
67070
67125
  if(p < minRange) t.periodX = minRange;
67071
67126
 
67072
- t.text = ' '; // don't use an empty string here which can confuse automargin (issue 5132)
67073
- ax._prevDateHead = '';
67127
+ hideLabel(t);
67074
67128
  }
67075
67129
  }
67076
67130
 
67131
+ if(tickVals[i].skipLabel) {
67132
+ hideLabel(t);
67133
+ }
67134
+
67077
67135
  ticksOut.push(t);
67078
67136
  }
67079
67137
 
@@ -69101,6 +69159,7 @@ axes.drawLabels = function(gd, ax, opts) {
69101
69159
  var axId = ax._id;
69102
69160
  var axLetter = axId.charAt(0);
69103
69161
  var cls = opts.cls || axId + 'tick';
69162
+
69104
69163
  var vals = opts.vals;
69105
69164
 
69106
69165
  var labelFns = opts.labelFns;
@@ -73957,6 +74016,12 @@ module.exports = {
73957
74016
  editType: 'ticks',
73958
74017
  impliedEdits: {tickmode: 'linear'},
73959
74018
  },
74019
+ ticklabelstep: {
74020
+ valType: 'integer',
74021
+ min: 1,
74022
+ dflt: 1,
74023
+ editType: 'ticks',
74024
+ },
73960
74025
  tickvals: {
73961
74026
  valType: 'data_array',
73962
74027
  editType: 'ticks',
@@ -76821,6 +76886,14 @@ module.exports = function handleTickLabelDefaults(containerIn, containerOut, coe
76821
76886
  color: dfltFontColor
76822
76887
  });
76823
76888
 
76889
+ if(
76890
+ !options.noTicklabelstep &&
76891
+ axType !== 'multicategory' &&
76892
+ axType !== 'log'
76893
+ ) {
76894
+ coerce('ticklabelstep');
76895
+ }
76896
+
76824
76897
  if(!options.noAng) coerce('tickangle');
76825
76898
 
76826
76899
  if(axType !== 'category') {
@@ -81939,6 +82012,7 @@ var ternaryAxesAttrs = {
81939
82012
  ticklen: axesAttrs.ticklen,
81940
82013
  tickwidth: axesAttrs.tickwidth,
81941
82014
  tickcolor: axesAttrs.tickcolor,
82015
+ ticklabelstep: axesAttrs.ticklabelstep,
81942
82016
  showticklabels: axesAttrs.showticklabels,
81943
82017
  showtickprefix: axesAttrs.showtickprefix,
81944
82018
  tickprefix: axesAttrs.tickprefix,
@@ -102817,7 +102891,7 @@ function getSortFunc(opts, d2c) {
102817
102891
  'use strict';
102818
102892
 
102819
102893
  // package version injected by `npm run preprocess`
102820
- exports.version = '2.8.3';
102894
+ exports.version = '2.9.0';
102821
102895
 
102822
102896
  },{}]},{},[15])(15)
102823
102897
  });