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 (gl3d) v2.8.0
3
- * Copyright 2012-2021, Plotly, Inc.
2
+ * plotly.js (gl3d) v2.9.0
3
+ * Copyright 2012-2022, Plotly, Inc.
4
4
  * All rights reserved.
5
5
  * Licensed under the MIT license
6
6
  */
@@ -22350,6 +22350,7 @@ module.exports = overrideAll({
22350
22350
  ticklen: axesAttrs.ticklen,
22351
22351
  tickwidth: axesAttrs.tickwidth,
22352
22352
  tickcolor: axesAttrs.tickcolor,
22353
+ ticklabelstep: axesAttrs.ticklabelstep,
22353
22354
  showticklabels: axesAttrs.showticklabels,
22354
22355
  tickfont: fontAttrs({
22355
22356
  }),
@@ -23440,6 +23441,7 @@ function mockColorBarAxis(gd, opts, zrange) {
23440
23441
  showticklabels: opts.showticklabels,
23441
23442
  ticklabelposition: opts.ticklabelposition,
23442
23443
  ticklabeloverflow: opts.ticklabeloverflow,
23444
+ ticklabelstep: opts.ticklabelstep,
23443
23445
  tickfont: opts.tickfont,
23444
23446
  tickangle: opts.tickangle,
23445
23447
  tickformat: opts.tickformat,
@@ -32246,7 +32248,6 @@ function computeLegendDimensions(gd, groups, traces, legendObj) {
32246
32248
  offsetY += h;
32247
32249
  maxWidthInGroup = Math.max(maxWidthInGroup, textGap + w);
32248
32250
  });
32249
- maxGroupHeightInRow = Math.max(maxGroupHeightInRow, offsetY);
32250
32251
 
32251
32252
  var next = maxWidthInGroup + itemGap;
32252
32253
 
@@ -32262,6 +32263,8 @@ function computeLegendDimensions(gd, groups, traces, legendObj) {
32262
32263
  groupOffsetX = 0;
32263
32264
  groupOffsetY += maxGroupHeightInRow + traceGroupGap;
32264
32265
  maxGroupHeightInRow = offsetY;
32266
+ } else {
32267
+ maxGroupHeightInRow = Math.max(maxGroupHeightInRow, offsetY);
32265
32268
  }
32266
32269
 
32267
32270
  Drawing.setTranslate(this, groupOffsetX, groupOffsetY);
@@ -34744,6 +34747,8 @@ var isNumeric = _dereq_('fast-isnumeric');
34744
34747
 
34745
34748
  var Lib = _dereq_('../../lib');
34746
34749
  var Icons = _dereq_('../../fonts/ploticon');
34750
+ var version = _dereq_('../../version').version;
34751
+
34747
34752
  var Parser = new DOMParser();
34748
34753
 
34749
34754
  /**
@@ -35022,6 +35027,10 @@ proto.hasButtons = function(buttons) {
35022
35027
  return true;
35023
35028
  };
35024
35029
 
35030
+ function jsVersion(str) {
35031
+ return str + ' (v' + version + ')';
35032
+ }
35033
+
35025
35034
  /**
35026
35035
  * @return {HTMLDivElement} The logo image wrapped in a group
35027
35036
  */
@@ -35031,7 +35040,7 @@ proto.getLogo = function() {
35031
35040
 
35032
35041
  a.href = 'https://plotly.com/';
35033
35042
  a.target = '_blank';
35034
- a.setAttribute('data-title', Lib._(this.graphInfo, 'Produced with Plotly'));
35043
+ a.setAttribute('data-title', jsVersion(Lib._(this.graphInfo, 'Produced with Plotly.js')));
35035
35044
  a.className = 'modebar-btn plotlyjsicon modebar-btn--logo';
35036
35045
 
35037
35046
  a.appendChild(this.createIcon(Icons.newplotlylogo));
@@ -35073,7 +35082,7 @@ function createModeBar(gd, buttons) {
35073
35082
 
35074
35083
  module.exports = createModeBar;
35075
35084
 
35076
- },{"../../fonts/ploticon":234,"../../lib":252,"@plotly/d3":16,"fast-isnumeric":31}],185:[function(_dereq_,module,exports){
35085
+ },{"../../fonts/ploticon":234,"../../lib":252,"../../version":434,"@plotly/d3":16,"fast-isnumeric":31}],185:[function(_dereq_,module,exports){
35077
35086
  'use strict';
35078
35087
 
35079
35088
  var fontAttrs = _dereq_('../../plots/font_attributes');
@@ -58652,7 +58661,8 @@ axes.calcTicks = function calcTicks(ax, opts) {
58652
58661
  var minRange = Math.min(rng[0], rng[1]);
58653
58662
  var maxRange = Math.max(rng[0], rng[1]);
58654
58663
 
58655
- var isDLog = (ax.type === 'log') && !(isNumeric(ax.dtick) || ax.dtick.charAt(0) === 'L');
58664
+ var numDtick = isNumeric(ax.dtick);
58665
+ var isDLog = (ax.type === 'log') && !(numDtick || ax.dtick.charAt(0) === 'L');
58656
58666
  var isPeriod = ax.ticklabelmode === 'period';
58657
58667
 
58658
58668
  // find the first tick
@@ -58683,13 +58693,36 @@ axes.calcTicks = function calcTicks(ax, opts) {
58683
58693
  x = axes.tickIncrement(x, ax.dtick, !axrev, ax.calendar);
58684
58694
  }
58685
58695
 
58696
+ var ticklabelstep = ax.ticklabelstep;
58697
+
58686
58698
  var maxTicks = Math.max(1000, ax._length || 0);
58687
58699
  var tickVals = [];
58688
58700
  var xPrevious = null;
58701
+
58702
+ var dTick;
58703
+ if(numDtick) {
58704
+ dTick = ax.dtick;
58705
+ } else {
58706
+ if(ax.type === 'date') {
58707
+ if(typeof ax.dtick === 'string' && ax.dtick.charAt(0) === 'M') {
58708
+ dTick = ONEAVGMONTH * ax.dtick.substring(1);
58709
+ }
58710
+ } else {
58711
+ dTick = ax._roughDTick;
58712
+ }
58713
+ }
58714
+
58715
+ var id = Math.round((
58716
+ ax.r2l(x) -
58717
+ ax.r2l(ax.tick0)
58718
+ ) / dTick) - 1;
58719
+
58689
58720
  for(;
58690
58721
  (axrev) ? (x >= endTick) : (x <= endTick);
58691
58722
  x = axes.tickIncrement(x, ax.dtick, axrev, ax.calendar)
58692
58723
  ) {
58724
+ id++;
58725
+
58693
58726
  if(ax.rangebreaks) {
58694
58727
  if(!axrev) {
58695
58728
  if(x < startTick) continue;
@@ -58707,10 +58740,16 @@ axes.calcTicks = function calcTicks(ax, opts) {
58707
58740
  minor = true;
58708
58741
  }
58709
58742
 
58710
- tickVals.push({
58743
+ var obj = {
58711
58744
  minor: minor,
58712
58745
  value: x
58713
- });
58746
+ };
58747
+
58748
+ if(ticklabelstep > 1 && id % ticklabelstep) {
58749
+ obj.skipLabel = true;
58750
+ }
58751
+
58752
+ tickVals.push(obj);
58714
58753
  }
58715
58754
 
58716
58755
  if(isPeriod) positionPeriodTicks(tickVals, ax, ax._definedDelta);
@@ -58763,12 +58802,20 @@ axes.calcTicks = function calcTicks(ax, opts) {
58763
58802
  ax._prevDateHead = '';
58764
58803
  ax._inCalcTicks = true;
58765
58804
 
58805
+ var lastVisibleHead;
58806
+ var hideLabel = function(tick) {
58807
+ tick.text = ' '; // don't use an empty string here which can confuse automargin (issue 5132)
58808
+ ax._prevDateHead = lastVisibleHead;
58809
+ };
58810
+
58766
58811
  var ticksOut = [];
58767
58812
  var t, p;
58768
58813
  for(i = 0; i < tickVals.length; i++) {
58769
58814
  var _minor = tickVals[i].minor;
58770
58815
  var _value = tickVals[i].value;
58771
58816
 
58817
+ lastVisibleHead = ax._prevDateHead;
58818
+
58772
58819
  t = axes.tickText(
58773
58820
  ax,
58774
58821
  _value,
@@ -58783,11 +58830,14 @@ axes.calcTicks = function calcTicks(ax, opts) {
58783
58830
  if(p > maxRange) t.periodX = maxRange;
58784
58831
  if(p < minRange) t.periodX = minRange;
58785
58832
 
58786
- t.text = ' '; // don't use an empty string here which can confuse automargin (issue 5132)
58787
- ax._prevDateHead = '';
58833
+ hideLabel(t);
58788
58834
  }
58789
58835
  }
58790
58836
 
58837
+ if(tickVals[i].skipLabel) {
58838
+ hideLabel(t);
58839
+ }
58840
+
58791
58841
  ticksOut.push(t);
58792
58842
  }
58793
58843
 
@@ -60815,6 +60865,7 @@ axes.drawLabels = function(gd, ax, opts) {
60815
60865
  var axId = ax._id;
60816
60866
  var axLetter = axId.charAt(0);
60817
60867
  var cls = opts.cls || axId + 'tick';
60868
+
60818
60869
  var vals = opts.vals;
60819
60870
 
60820
60871
  var labelFns = opts.labelFns;
@@ -65671,6 +65722,12 @@ module.exports = {
65671
65722
  editType: 'ticks',
65672
65723
  impliedEdits: {tickmode: 'linear'},
65673
65724
  },
65725
+ ticklabelstep: {
65726
+ valType: 'integer',
65727
+ min: 1,
65728
+ dflt: 1,
65729
+ editType: 'ticks',
65730
+ },
65674
65731
  tickvals: {
65675
65732
  valType: 'data_array',
65676
65733
  editType: 'ticks',
@@ -68535,6 +68592,14 @@ module.exports = function handleTickLabelDefaults(containerIn, containerOut, coe
68535
68592
  color: dfltFontColor
68536
68593
  });
68537
68594
 
68595
+ if(
68596
+ !options.noTicklabelstep &&
68597
+ axType !== 'multicategory' &&
68598
+ axType !== 'log'
68599
+ ) {
68600
+ coerce('ticklabelstep');
68601
+ }
68602
+
68538
68603
  if(!options.noAng) coerce('tickangle');
68539
68604
 
68540
68605
  if(axType !== 'category') {
@@ -70000,6 +70065,7 @@ module.exports = function supplyLayoutDefaults(layoutIn, layoutOut, options) {
70000
70065
  showGrid: true,
70001
70066
  noTickson: true,
70002
70067
  noTicklabelmode: true,
70068
+ noTicklabelstep: true,
70003
70069
  noTicklabelposition: true,
70004
70070
  noTicklabeloverflow: true,
70005
70071
  bgColor: options.bgColor,
@@ -86285,7 +86351,7 @@ function getSortFunc(opts, d2c) {
86285
86351
  'use strict';
86286
86352
 
86287
86353
  // package version injected by `npm run preprocess`
86288
- exports.version = '2.8.0';
86354
+ exports.version = '2.9.0';
86289
86355
 
86290
86356
  },{}],435:[function(_dereq_,module,exports){
86291
86357
  (function (global){(function (){