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 (gl2d) v2.8.3
3
- * Copyright 2012-2021, Plotly, Inc.
2
+ * plotly.js (gl2d) v2.9.0
3
+ * Copyright 2012-2022, Plotly, Inc.
4
4
  * All rights reserved.
5
5
  * Licensed under the MIT license
6
6
  */
@@ -35122,6 +35122,7 @@ module.exports = overrideAll({
35122
35122
  ticklen: axesAttrs.ticklen,
35123
35123
  tickwidth: axesAttrs.tickwidth,
35124
35124
  tickcolor: axesAttrs.tickcolor,
35125
+ ticklabelstep: axesAttrs.ticklabelstep,
35125
35126
  showticklabels: axesAttrs.showticklabels,
35126
35127
  tickfont: fontAttrs({
35127
35128
  }),
@@ -36212,6 +36213,7 @@ function mockColorBarAxis(gd, opts, zrange) {
36212
36213
  showticklabels: opts.showticklabels,
36213
36214
  ticklabelposition: opts.ticklabelposition,
36214
36215
  ticklabeloverflow: opts.ticklabeloverflow,
36216
+ ticklabelstep: opts.ticklabelstep,
36215
36217
  tickfont: opts.tickfont,
36216
36218
  tickangle: opts.tickangle,
36217
36219
  tickformat: opts.tickformat,
@@ -45018,7 +45020,6 @@ function computeLegendDimensions(gd, groups, traces, legendObj) {
45018
45020
  offsetY += h;
45019
45021
  maxWidthInGroup = Math.max(maxWidthInGroup, textGap + w);
45020
45022
  });
45021
- maxGroupHeightInRow = Math.max(maxGroupHeightInRow, offsetY);
45022
45023
 
45023
45024
  var next = maxWidthInGroup + itemGap;
45024
45025
 
@@ -45034,6 +45035,8 @@ function computeLegendDimensions(gd, groups, traces, legendObj) {
45034
45035
  groupOffsetX = 0;
45035
45036
  groupOffsetY += maxGroupHeightInRow + traceGroupGap;
45036
45037
  maxGroupHeightInRow = offsetY;
45038
+ } else {
45039
+ maxGroupHeightInRow = Math.max(maxGroupHeightInRow, offsetY);
45037
45040
  }
45038
45041
 
45039
45042
  Drawing.setTranslate(this, groupOffsetX, groupOffsetY);
@@ -47516,6 +47519,8 @@ var isNumeric = _dereq_('fast-isnumeric');
47516
47519
 
47517
47520
  var Lib = _dereq_('../../lib');
47518
47521
  var Icons = _dereq_('../../fonts/ploticon');
47522
+ var version = _dereq_('../../version').version;
47523
+
47519
47524
  var Parser = new DOMParser();
47520
47525
 
47521
47526
  /**
@@ -47794,6 +47799,10 @@ proto.hasButtons = function(buttons) {
47794
47799
  return true;
47795
47800
  };
47796
47801
 
47802
+ function jsVersion(str) {
47803
+ return str + ' (v' + version + ')';
47804
+ }
47805
+
47797
47806
  /**
47798
47807
  * @return {HTMLDivElement} The logo image wrapped in a group
47799
47808
  */
@@ -47803,7 +47812,7 @@ proto.getLogo = function() {
47803
47812
 
47804
47813
  a.href = 'https://plotly.com/';
47805
47814
  a.target = '_blank';
47806
- a.setAttribute('data-title', Lib._(this.graphInfo, 'Produced with Plotly'));
47815
+ a.setAttribute('data-title', jsVersion(Lib._(this.graphInfo, 'Produced with Plotly.js')));
47807
47816
  a.className = 'modebar-btn plotlyjsicon modebar-btn--logo';
47808
47817
 
47809
47818
  a.appendChild(this.createIcon(Icons.newplotlylogo));
@@ -47845,7 +47854,7 @@ function createModeBar(gd, buttons) {
47845
47854
 
47846
47855
  module.exports = createModeBar;
47847
47856
 
47848
- },{"../../fonts/ploticon":369,"../../lib":388,"@plotly/d3":14,"fast-isnumeric":121}],322:[function(_dereq_,module,exports){
47857
+ },{"../../fonts/ploticon":369,"../../lib":388,"../../version":587,"@plotly/d3":14,"fast-isnumeric":121}],322:[function(_dereq_,module,exports){
47849
47858
  'use strict';
47850
47859
 
47851
47860
  var fontAttrs = _dereq_('../../plots/font_attributes');
@@ -71492,7 +71501,8 @@ axes.calcTicks = function calcTicks(ax, opts) {
71492
71501
  var minRange = Math.min(rng[0], rng[1]);
71493
71502
  var maxRange = Math.max(rng[0], rng[1]);
71494
71503
 
71495
- var isDLog = (ax.type === 'log') && !(isNumeric(ax.dtick) || ax.dtick.charAt(0) === 'L');
71504
+ var numDtick = isNumeric(ax.dtick);
71505
+ var isDLog = (ax.type === 'log') && !(numDtick || ax.dtick.charAt(0) === 'L');
71496
71506
  var isPeriod = ax.ticklabelmode === 'period';
71497
71507
 
71498
71508
  // find the first tick
@@ -71523,13 +71533,36 @@ axes.calcTicks = function calcTicks(ax, opts) {
71523
71533
  x = axes.tickIncrement(x, ax.dtick, !axrev, ax.calendar);
71524
71534
  }
71525
71535
 
71536
+ var ticklabelstep = ax.ticklabelstep;
71537
+
71526
71538
  var maxTicks = Math.max(1000, ax._length || 0);
71527
71539
  var tickVals = [];
71528
71540
  var xPrevious = null;
71541
+
71542
+ var dTick;
71543
+ if(numDtick) {
71544
+ dTick = ax.dtick;
71545
+ } else {
71546
+ if(ax.type === 'date') {
71547
+ if(typeof ax.dtick === 'string' && ax.dtick.charAt(0) === 'M') {
71548
+ dTick = ONEAVGMONTH * ax.dtick.substring(1);
71549
+ }
71550
+ } else {
71551
+ dTick = ax._roughDTick;
71552
+ }
71553
+ }
71554
+
71555
+ var id = Math.round((
71556
+ ax.r2l(x) -
71557
+ ax.r2l(ax.tick0)
71558
+ ) / dTick) - 1;
71559
+
71529
71560
  for(;
71530
71561
  (axrev) ? (x >= endTick) : (x <= endTick);
71531
71562
  x = axes.tickIncrement(x, ax.dtick, axrev, ax.calendar)
71532
71563
  ) {
71564
+ id++;
71565
+
71533
71566
  if(ax.rangebreaks) {
71534
71567
  if(!axrev) {
71535
71568
  if(x < startTick) continue;
@@ -71547,10 +71580,16 @@ axes.calcTicks = function calcTicks(ax, opts) {
71547
71580
  minor = true;
71548
71581
  }
71549
71582
 
71550
- tickVals.push({
71583
+ var obj = {
71551
71584
  minor: minor,
71552
71585
  value: x
71553
- });
71586
+ };
71587
+
71588
+ if(ticklabelstep > 1 && id % ticklabelstep) {
71589
+ obj.skipLabel = true;
71590
+ }
71591
+
71592
+ tickVals.push(obj);
71554
71593
  }
71555
71594
 
71556
71595
  if(isPeriod) positionPeriodTicks(tickVals, ax, ax._definedDelta);
@@ -71603,12 +71642,20 @@ axes.calcTicks = function calcTicks(ax, opts) {
71603
71642
  ax._prevDateHead = '';
71604
71643
  ax._inCalcTicks = true;
71605
71644
 
71645
+ var lastVisibleHead;
71646
+ var hideLabel = function(tick) {
71647
+ tick.text = ' '; // don't use an empty string here which can confuse automargin (issue 5132)
71648
+ ax._prevDateHead = lastVisibleHead;
71649
+ };
71650
+
71606
71651
  var ticksOut = [];
71607
71652
  var t, p;
71608
71653
  for(i = 0; i < tickVals.length; i++) {
71609
71654
  var _minor = tickVals[i].minor;
71610
71655
  var _value = tickVals[i].value;
71611
71656
 
71657
+ lastVisibleHead = ax._prevDateHead;
71658
+
71612
71659
  t = axes.tickText(
71613
71660
  ax,
71614
71661
  _value,
@@ -71623,11 +71670,14 @@ axes.calcTicks = function calcTicks(ax, opts) {
71623
71670
  if(p > maxRange) t.periodX = maxRange;
71624
71671
  if(p < minRange) t.periodX = minRange;
71625
71672
 
71626
- t.text = ' '; // don't use an empty string here which can confuse automargin (issue 5132)
71627
- ax._prevDateHead = '';
71673
+ hideLabel(t);
71628
71674
  }
71629
71675
  }
71630
71676
 
71677
+ if(tickVals[i].skipLabel) {
71678
+ hideLabel(t);
71679
+ }
71680
+
71631
71681
  ticksOut.push(t);
71632
71682
  }
71633
71683
 
@@ -73655,6 +73705,7 @@ axes.drawLabels = function(gd, ax, opts) {
73655
73705
  var axId = ax._id;
73656
73706
  var axLetter = axId.charAt(0);
73657
73707
  var cls = opts.cls || axId + 'tick';
73708
+
73658
73709
  var vals = opts.vals;
73659
73710
 
73660
73711
  var labelFns = opts.labelFns;
@@ -78511,6 +78562,12 @@ module.exports = {
78511
78562
  editType: 'ticks',
78512
78563
  impliedEdits: {tickmode: 'linear'},
78513
78564
  },
78565
+ ticklabelstep: {
78566
+ valType: 'integer',
78567
+ min: 1,
78568
+ dflt: 1,
78569
+ editType: 'ticks',
78570
+ },
78514
78571
  tickvals: {
78515
78572
  valType: 'data_array',
78516
78573
  editType: 'ticks',
@@ -81375,6 +81432,14 @@ module.exports = function handleTickLabelDefaults(containerIn, containerOut, coe
81375
81432
  color: dfltFontColor
81376
81433
  });
81377
81434
 
81435
+ if(
81436
+ !options.noTicklabelstep &&
81437
+ axType !== 'multicategory' &&
81438
+ axType !== 'log'
81439
+ ) {
81440
+ coerce('ticklabelstep');
81441
+ }
81442
+
81378
81443
  if(!options.noAng) coerce('tickangle');
81379
81444
 
81380
81445
  if(axType !== 'category') {
@@ -100910,7 +100975,7 @@ function getSortFunc(opts, d2c) {
100910
100975
  'use strict';
100911
100976
 
100912
100977
  // package version injected by `npm run preprocess`
100913
- exports.version = '2.8.3';
100978
+ exports.version = '2.9.0';
100914
100979
 
100915
100980
  },{}],588:[function(_dereq_,module,exports){
100916
100981
  (function (global){(function (){