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 (mapbox) v2.8.0
3
- * Copyright 2012-2021, Plotly, Inc.
2
+ * plotly.js (mapbox) v2.9.0
3
+ * Copyright 2012-2022, Plotly, Inc.
4
4
  * All rights reserved.
5
5
  * Licensed under the MIT license
6
6
  */
@@ -68923,6 +68923,7 @@ module.exports = overrideAll({
68923
68923
  ticklen: axesAttrs.ticklen,
68924
68924
  tickwidth: axesAttrs.tickwidth,
68925
68925
  tickcolor: axesAttrs.tickcolor,
68926
+ ticklabelstep: axesAttrs.ticklabelstep,
68926
68927
  showticklabels: axesAttrs.showticklabels,
68927
68928
  tickfont: fontAttrs({
68928
68929
  }),
@@ -70013,6 +70014,7 @@ function mockColorBarAxis(gd, opts, zrange) {
70013
70014
  showticklabels: opts.showticklabels,
70014
70015
  ticklabelposition: opts.ticklabelposition,
70015
70016
  ticklabeloverflow: opts.ticklabeloverflow,
70017
+ ticklabelstep: opts.ticklabelstep,
70016
70018
  tickfont: opts.tickfont,
70017
70019
  tickangle: opts.tickangle,
70018
70020
  tickformat: opts.tickformat,
@@ -78819,7 +78821,6 @@ function computeLegendDimensions(gd, groups, traces, legendObj) {
78819
78821
  offsetY += h;
78820
78822
  maxWidthInGroup = Math.max(maxWidthInGroup, textGap + w);
78821
78823
  });
78822
- maxGroupHeightInRow = Math.max(maxGroupHeightInRow, offsetY);
78823
78824
 
78824
78825
  var next = maxWidthInGroup + itemGap;
78825
78826
 
@@ -78835,6 +78836,8 @@ function computeLegendDimensions(gd, groups, traces, legendObj) {
78835
78836
  groupOffsetX = 0;
78836
78837
  groupOffsetY += maxGroupHeightInRow + traceGroupGap;
78837
78838
  maxGroupHeightInRow = offsetY;
78839
+ } else {
78840
+ maxGroupHeightInRow = Math.max(maxGroupHeightInRow, offsetY);
78838
78841
  }
78839
78842
 
78840
78843
  Drawing.setTranslate(this, groupOffsetX, groupOffsetY);
@@ -81317,6 +81320,8 @@ var isNumeric = _dereq_('fast-isnumeric');
81317
81320
 
81318
81321
  var Lib = _dereq_('../../lib');
81319
81322
  var Icons = _dereq_('../../fonts/ploticon');
81323
+ var version = _dereq_('../../version').version;
81324
+
81320
81325
  var Parser = new DOMParser();
81321
81326
 
81322
81327
  /**
@@ -81595,6 +81600,10 @@ proto.hasButtons = function(buttons) {
81595
81600
  return true;
81596
81601
  };
81597
81602
 
81603
+ function jsVersion(str) {
81604
+ return str + ' (v' + version + ')';
81605
+ }
81606
+
81598
81607
  /**
81599
81608
  * @return {HTMLDivElement} The logo image wrapped in a group
81600
81609
  */
@@ -81604,7 +81613,7 @@ proto.getLogo = function() {
81604
81613
 
81605
81614
  a.href = 'https://plotly.com/';
81606
81615
  a.target = '_blank';
81607
- a.setAttribute('data-title', Lib._(this.graphInfo, 'Produced with Plotly'));
81616
+ a.setAttribute('data-title', jsVersion(Lib._(this.graphInfo, 'Produced with Plotly.js')));
81608
81617
  a.className = 'modebar-btn plotlyjsicon modebar-btn--logo';
81609
81618
 
81610
81619
  a.appendChild(this.createIcon(Icons.newplotlylogo));
@@ -81646,7 +81655,7 @@ function createModeBar(gd, buttons) {
81646
81655
 
81647
81656
  module.exports = createModeBar;
81648
81657
 
81649
- },{"../../fonts/ploticon":227,"../../lib":246,"@plotly/d3":12,"fast-isnumeric":28}],180:[function(_dereq_,module,exports){
81658
+ },{"../../fonts/ploticon":227,"../../lib":246,"../../version":415,"@plotly/d3":12,"fast-isnumeric":28}],180:[function(_dereq_,module,exports){
81650
81659
  'use strict';
81651
81660
 
81652
81661
  var fontAttrs = _dereq_('../../plots/font_attributes');
@@ -105524,7 +105533,8 @@ axes.calcTicks = function calcTicks(ax, opts) {
105524
105533
  var minRange = Math.min(rng[0], rng[1]);
105525
105534
  var maxRange = Math.max(rng[0], rng[1]);
105526
105535
 
105527
- var isDLog = (ax.type === 'log') && !(isNumeric(ax.dtick) || ax.dtick.charAt(0) === 'L');
105536
+ var numDtick = isNumeric(ax.dtick);
105537
+ var isDLog = (ax.type === 'log') && !(numDtick || ax.dtick.charAt(0) === 'L');
105528
105538
  var isPeriod = ax.ticklabelmode === 'period';
105529
105539
 
105530
105540
  // find the first tick
@@ -105555,13 +105565,36 @@ axes.calcTicks = function calcTicks(ax, opts) {
105555
105565
  x = axes.tickIncrement(x, ax.dtick, !axrev, ax.calendar);
105556
105566
  }
105557
105567
 
105568
+ var ticklabelstep = ax.ticklabelstep;
105569
+
105558
105570
  var maxTicks = Math.max(1000, ax._length || 0);
105559
105571
  var tickVals = [];
105560
105572
  var xPrevious = null;
105573
+
105574
+ var dTick;
105575
+ if(numDtick) {
105576
+ dTick = ax.dtick;
105577
+ } else {
105578
+ if(ax.type === 'date') {
105579
+ if(typeof ax.dtick === 'string' && ax.dtick.charAt(0) === 'M') {
105580
+ dTick = ONEAVGMONTH * ax.dtick.substring(1);
105581
+ }
105582
+ } else {
105583
+ dTick = ax._roughDTick;
105584
+ }
105585
+ }
105586
+
105587
+ var id = Math.round((
105588
+ ax.r2l(x) -
105589
+ ax.r2l(ax.tick0)
105590
+ ) / dTick) - 1;
105591
+
105561
105592
  for(;
105562
105593
  (axrev) ? (x >= endTick) : (x <= endTick);
105563
105594
  x = axes.tickIncrement(x, ax.dtick, axrev, ax.calendar)
105564
105595
  ) {
105596
+ id++;
105597
+
105565
105598
  if(ax.rangebreaks) {
105566
105599
  if(!axrev) {
105567
105600
  if(x < startTick) continue;
@@ -105579,10 +105612,16 @@ axes.calcTicks = function calcTicks(ax, opts) {
105579
105612
  minor = true;
105580
105613
  }
105581
105614
 
105582
- tickVals.push({
105615
+ var obj = {
105583
105616
  minor: minor,
105584
105617
  value: x
105585
- });
105618
+ };
105619
+
105620
+ if(ticklabelstep > 1 && id % ticklabelstep) {
105621
+ obj.skipLabel = true;
105622
+ }
105623
+
105624
+ tickVals.push(obj);
105586
105625
  }
105587
105626
 
105588
105627
  if(isPeriod) positionPeriodTicks(tickVals, ax, ax._definedDelta);
@@ -105635,12 +105674,20 @@ axes.calcTicks = function calcTicks(ax, opts) {
105635
105674
  ax._prevDateHead = '';
105636
105675
  ax._inCalcTicks = true;
105637
105676
 
105677
+ var lastVisibleHead;
105678
+ var hideLabel = function(tick) {
105679
+ tick.text = ' '; // don't use an empty string here which can confuse automargin (issue 5132)
105680
+ ax._prevDateHead = lastVisibleHead;
105681
+ };
105682
+
105638
105683
  var ticksOut = [];
105639
105684
  var t, p;
105640
105685
  for(i = 0; i < tickVals.length; i++) {
105641
105686
  var _minor = tickVals[i].minor;
105642
105687
  var _value = tickVals[i].value;
105643
105688
 
105689
+ lastVisibleHead = ax._prevDateHead;
105690
+
105644
105691
  t = axes.tickText(
105645
105692
  ax,
105646
105693
  _value,
@@ -105655,11 +105702,14 @@ axes.calcTicks = function calcTicks(ax, opts) {
105655
105702
  if(p > maxRange) t.periodX = maxRange;
105656
105703
  if(p < minRange) t.periodX = minRange;
105657
105704
 
105658
- t.text = ' '; // don't use an empty string here which can confuse automargin (issue 5132)
105659
- ax._prevDateHead = '';
105705
+ hideLabel(t);
105660
105706
  }
105661
105707
  }
105662
105708
 
105709
+ if(tickVals[i].skipLabel) {
105710
+ hideLabel(t);
105711
+ }
105712
+
105663
105713
  ticksOut.push(t);
105664
105714
  }
105665
105715
 
@@ -107687,6 +107737,7 @@ axes.drawLabels = function(gd, ax, opts) {
107687
107737
  var axId = ax._id;
107688
107738
  var axLetter = axId.charAt(0);
107689
107739
  var cls = opts.cls || axId + 'tick';
107740
+
107690
107741
  var vals = opts.vals;
107691
107742
 
107692
107743
  var labelFns = opts.labelFns;
@@ -112543,6 +112594,12 @@ module.exports = {
112543
112594
  editType: 'ticks',
112544
112595
  impliedEdits: {tickmode: 'linear'},
112545
112596
  },
112597
+ ticklabelstep: {
112598
+ valType: 'integer',
112599
+ min: 1,
112600
+ dflt: 1,
112601
+ editType: 'ticks',
112602
+ },
112546
112603
  tickvals: {
112547
112604
  valType: 'data_array',
112548
112605
  editType: 'ticks',
@@ -115407,6 +115464,14 @@ module.exports = function handleTickLabelDefaults(containerIn, containerOut, coe
115407
115464
  color: dfltFontColor
115408
115465
  });
115409
115466
 
115467
+ if(
115468
+ !options.noTicklabelstep &&
115469
+ axType !== 'multicategory' &&
115470
+ axType !== 'log'
115471
+ ) {
115472
+ coerce('ticklabelstep');
115473
+ }
115474
+
115410
115475
  if(!options.noAng) coerce('tickangle');
115411
115476
 
115412
115477
  if(axType !== 'category') {
@@ -129839,7 +129904,7 @@ function getSortFunc(opts, d2c) {
129839
129904
  'use strict';
129840
129905
 
129841
129906
  // package version injected by `npm run preprocess`
129842
- exports.version = '2.8.0';
129907
+ exports.version = '2.9.0';
129843
129908
 
129844
129909
  },{}]},{},[9])(9)
129845
129910
  });