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 (finance) v2.8.0
3
- * Copyright 2012-2021, Plotly, Inc.
2
+ * plotly.js (finance) v2.9.0
3
+ * Copyright 2012-2022, Plotly, Inc.
4
4
  * All rights reserved.
5
5
  * Licensed under the MIT license
6
6
  */
@@ -22880,6 +22880,7 @@ module.exports = overrideAll({
22880
22880
  ticklen: axesAttrs.ticklen,
22881
22881
  tickwidth: axesAttrs.tickwidth,
22882
22882
  tickcolor: axesAttrs.tickcolor,
22883
+ ticklabelstep: axesAttrs.ticklabelstep,
22883
22884
  showticklabels: axesAttrs.showticklabels,
22884
22885
  tickfont: fontAttrs({
22885
22886
  }),
@@ -23970,6 +23971,7 @@ function mockColorBarAxis(gd, opts, zrange) {
23970
23971
  showticklabels: opts.showticklabels,
23971
23972
  ticklabelposition: opts.ticklabelposition,
23972
23973
  ticklabeloverflow: opts.ticklabeloverflow,
23974
+ ticklabelstep: opts.ticklabelstep,
23973
23975
  tickfont: opts.tickfont,
23974
23976
  tickangle: opts.tickangle,
23975
23977
  tickformat: opts.tickformat,
@@ -32776,7 +32778,6 @@ function computeLegendDimensions(gd, groups, traces, legendObj) {
32776
32778
  offsetY += h;
32777
32779
  maxWidthInGroup = Math.max(maxWidthInGroup, textGap + w);
32778
32780
  });
32779
- maxGroupHeightInRow = Math.max(maxGroupHeightInRow, offsetY);
32780
32781
 
32781
32782
  var next = maxWidthInGroup + itemGap;
32782
32783
 
@@ -32792,6 +32793,8 @@ function computeLegendDimensions(gd, groups, traces, legendObj) {
32792
32793
  groupOffsetX = 0;
32793
32794
  groupOffsetY += maxGroupHeightInRow + traceGroupGap;
32794
32795
  maxGroupHeightInRow = offsetY;
32796
+ } else {
32797
+ maxGroupHeightInRow = Math.max(maxGroupHeightInRow, offsetY);
32795
32798
  }
32796
32799
 
32797
32800
  Drawing.setTranslate(this, groupOffsetX, groupOffsetY);
@@ -35274,6 +35277,8 @@ var isNumeric = _dereq_('fast-isnumeric');
35274
35277
 
35275
35278
  var Lib = _dereq_('../../lib');
35276
35279
  var Icons = _dereq_('../../fonts/ploticon');
35280
+ var version = _dereq_('../../version').version;
35281
+
35277
35282
  var Parser = new DOMParser();
35278
35283
 
35279
35284
  /**
@@ -35552,6 +35557,10 @@ proto.hasButtons = function(buttons) {
35552
35557
  return true;
35553
35558
  };
35554
35559
 
35560
+ function jsVersion(str) {
35561
+ return str + ' (v' + version + ')';
35562
+ }
35563
+
35555
35564
  /**
35556
35565
  * @return {HTMLDivElement} The logo image wrapped in a group
35557
35566
  */
@@ -35561,7 +35570,7 @@ proto.getLogo = function() {
35561
35570
 
35562
35571
  a.href = 'https://plotly.com/';
35563
35572
  a.target = '_blank';
35564
- a.setAttribute('data-title', Lib._(this.graphInfo, 'Produced with Plotly'));
35573
+ a.setAttribute('data-title', jsVersion(Lib._(this.graphInfo, 'Produced with Plotly.js')));
35565
35574
  a.className = 'modebar-btn plotlyjsicon modebar-btn--logo';
35566
35575
 
35567
35576
  a.appendChild(this.createIcon(Icons.newplotlylogo));
@@ -35603,7 +35612,7 @@ function createModeBar(gd, buttons) {
35603
35612
 
35604
35613
  module.exports = createModeBar;
35605
35614
 
35606
- },{"../../fonts/ploticon":225,"../../lib":242,"@plotly/d3":18,"fast-isnumeric":26}],177:[function(_dereq_,module,exports){
35615
+ },{"../../fonts/ploticon":225,"../../lib":242,"../../version":474,"@plotly/d3":18,"fast-isnumeric":26}],177:[function(_dereq_,module,exports){
35607
35616
  'use strict';
35608
35617
 
35609
35618
  var fontAttrs = _dereq_('../../plots/font_attributes');
@@ -59010,7 +59019,8 @@ axes.calcTicks = function calcTicks(ax, opts) {
59010
59019
  var minRange = Math.min(rng[0], rng[1]);
59011
59020
  var maxRange = Math.max(rng[0], rng[1]);
59012
59021
 
59013
- var isDLog = (ax.type === 'log') && !(isNumeric(ax.dtick) || ax.dtick.charAt(0) === 'L');
59022
+ var numDtick = isNumeric(ax.dtick);
59023
+ var isDLog = (ax.type === 'log') && !(numDtick || ax.dtick.charAt(0) === 'L');
59014
59024
  var isPeriod = ax.ticklabelmode === 'period';
59015
59025
 
59016
59026
  // find the first tick
@@ -59041,13 +59051,36 @@ axes.calcTicks = function calcTicks(ax, opts) {
59041
59051
  x = axes.tickIncrement(x, ax.dtick, !axrev, ax.calendar);
59042
59052
  }
59043
59053
 
59054
+ var ticklabelstep = ax.ticklabelstep;
59055
+
59044
59056
  var maxTicks = Math.max(1000, ax._length || 0);
59045
59057
  var tickVals = [];
59046
59058
  var xPrevious = null;
59059
+
59060
+ var dTick;
59061
+ if(numDtick) {
59062
+ dTick = ax.dtick;
59063
+ } else {
59064
+ if(ax.type === 'date') {
59065
+ if(typeof ax.dtick === 'string' && ax.dtick.charAt(0) === 'M') {
59066
+ dTick = ONEAVGMONTH * ax.dtick.substring(1);
59067
+ }
59068
+ } else {
59069
+ dTick = ax._roughDTick;
59070
+ }
59071
+ }
59072
+
59073
+ var id = Math.round((
59074
+ ax.r2l(x) -
59075
+ ax.r2l(ax.tick0)
59076
+ ) / dTick) - 1;
59077
+
59047
59078
  for(;
59048
59079
  (axrev) ? (x >= endTick) : (x <= endTick);
59049
59080
  x = axes.tickIncrement(x, ax.dtick, axrev, ax.calendar)
59050
59081
  ) {
59082
+ id++;
59083
+
59051
59084
  if(ax.rangebreaks) {
59052
59085
  if(!axrev) {
59053
59086
  if(x < startTick) continue;
@@ -59065,10 +59098,16 @@ axes.calcTicks = function calcTicks(ax, opts) {
59065
59098
  minor = true;
59066
59099
  }
59067
59100
 
59068
- tickVals.push({
59101
+ var obj = {
59069
59102
  minor: minor,
59070
59103
  value: x
59071
- });
59104
+ };
59105
+
59106
+ if(ticklabelstep > 1 && id % ticklabelstep) {
59107
+ obj.skipLabel = true;
59108
+ }
59109
+
59110
+ tickVals.push(obj);
59072
59111
  }
59073
59112
 
59074
59113
  if(isPeriod) positionPeriodTicks(tickVals, ax, ax._definedDelta);
@@ -59121,12 +59160,20 @@ axes.calcTicks = function calcTicks(ax, opts) {
59121
59160
  ax._prevDateHead = '';
59122
59161
  ax._inCalcTicks = true;
59123
59162
 
59163
+ var lastVisibleHead;
59164
+ var hideLabel = function(tick) {
59165
+ tick.text = ' '; // don't use an empty string here which can confuse automargin (issue 5132)
59166
+ ax._prevDateHead = lastVisibleHead;
59167
+ };
59168
+
59124
59169
  var ticksOut = [];
59125
59170
  var t, p;
59126
59171
  for(i = 0; i < tickVals.length; i++) {
59127
59172
  var _minor = tickVals[i].minor;
59128
59173
  var _value = tickVals[i].value;
59129
59174
 
59175
+ lastVisibleHead = ax._prevDateHead;
59176
+
59130
59177
  t = axes.tickText(
59131
59178
  ax,
59132
59179
  _value,
@@ -59141,11 +59188,14 @@ axes.calcTicks = function calcTicks(ax, opts) {
59141
59188
  if(p > maxRange) t.periodX = maxRange;
59142
59189
  if(p < minRange) t.periodX = minRange;
59143
59190
 
59144
- t.text = ' '; // don't use an empty string here which can confuse automargin (issue 5132)
59145
- ax._prevDateHead = '';
59191
+ hideLabel(t);
59146
59192
  }
59147
59193
  }
59148
59194
 
59195
+ if(tickVals[i].skipLabel) {
59196
+ hideLabel(t);
59197
+ }
59198
+
59149
59199
  ticksOut.push(t);
59150
59200
  }
59151
59201
 
@@ -61173,6 +61223,7 @@ axes.drawLabels = function(gd, ax, opts) {
61173
61223
  var axId = ax._id;
61174
61224
  var axLetter = axId.charAt(0);
61175
61225
  var cls = opts.cls || axId + 'tick';
61226
+
61176
61227
  var vals = opts.vals;
61177
61228
 
61178
61229
  var labelFns = opts.labelFns;
@@ -66029,6 +66080,12 @@ module.exports = {
66029
66080
  editType: 'ticks',
66030
66081
  impliedEdits: {tickmode: 'linear'},
66031
66082
  },
66083
+ ticklabelstep: {
66084
+ valType: 'integer',
66085
+ min: 1,
66086
+ dflt: 1,
66087
+ editType: 'ticks',
66088
+ },
66032
66089
  tickvals: {
66033
66090
  valType: 'data_array',
66034
66091
  editType: 'ticks',
@@ -68893,6 +68950,14 @@ module.exports = function handleTickLabelDefaults(containerIn, containerOut, coe
68893
68950
  color: dfltFontColor
68894
68951
  });
68895
68952
 
68953
+ if(
68954
+ !options.noTicklabelstep &&
68955
+ axType !== 'multicategory' &&
68956
+ axType !== 'log'
68957
+ ) {
68958
+ coerce('ticklabelstep');
68959
+ }
68960
+
68896
68961
  if(!options.noAng) coerce('tickangle');
68897
68962
 
68898
68963
  if(axType !== 'category') {
@@ -77356,12 +77421,14 @@ function calcTexttemplate(fullLayout, cd, index, xa, ya) {
77356
77421
  var trace = cd[0].trace;
77357
77422
  var texttemplate = Lib.castOption(trace, index, 'texttemplate');
77358
77423
  if(!texttemplate) return '';
77424
+ var isHistogram = (trace.type === 'histogram');
77359
77425
  var isWaterfall = (trace.type === 'waterfall');
77360
77426
  var isFunnel = (trace.type === 'funnel');
77427
+ var isHorizontal = trace.orientation === 'h';
77361
77428
 
77362
77429
  var pLetter, pAxis;
77363
77430
  var vLetter, vAxis;
77364
- if(trace.orientation === 'h') {
77431
+ if(isHorizontal) {
77365
77432
  pLetter = 'y';
77366
77433
  pAxis = ya;
77367
77434
  vLetter = 'x';
@@ -77396,6 +77463,11 @@ function calcTexttemplate(fullLayout, cd, index, xa, ya) {
77396
77463
  var pt = {};
77397
77464
  appendArrayPointValue(pt, trace, cdi.i);
77398
77465
 
77466
+ if(isHistogram || pt.x === undefined) pt.x = isHorizontal ? obj.value : obj.label;
77467
+ if(isHistogram || pt.y === undefined) pt.y = isHorizontal ? obj.label : obj.value;
77468
+ if(isHistogram || pt.xLabel === undefined) pt.xLabel = isHorizontal ? obj.valueLabel : obj.labelLabel;
77469
+ if(isHistogram || pt.yLabel === undefined) pt.yLabel = isHorizontal ? obj.labelLabel : obj.valueLabel;
77470
+
77399
77471
  if(isWaterfall) {
77400
77472
  obj.delta = +cdi.rawS || cdi.s;
77401
77473
  obj.deltaLabel = formatNumber(obj.delta);
@@ -80830,8 +80902,9 @@ var getBinSpanLabelRound = _dereq_('./bin_label_vals');
80830
80902
  function calc(gd, trace) {
80831
80903
  var pos = [];
80832
80904
  var size = [];
80833
- var pa = Axes.getFromId(gd, trace.orientation === 'h' ? trace.yaxis : trace.xaxis);
80834
- var mainData = trace.orientation === 'h' ? 'y' : 'x';
80905
+ var isHorizontal = trace.orientation === 'h';
80906
+ var pa = Axes.getFromId(gd, isHorizontal ? trace.yaxis : trace.xaxis);
80907
+ var mainData = isHorizontal ? 'y' : 'x';
80835
80908
  var counterData = {x: 'y', y: 'x'}[mainData];
80836
80909
  var calendar = trace[mainData + 'calendar'];
80837
80910
  var cumulativeSpec = trace.cumulative;
@@ -82081,6 +82154,7 @@ module.exports = {
82081
82154
  ticklen: axesAttrs.ticklen,
82082
82155
  tickwidth: axesAttrs.tickwidth,
82083
82156
  tickcolor: axesAttrs.tickcolor,
82157
+ ticklabelstep: axesAttrs.ticklabelstep,
82084
82158
  showticklabels: axesAttrs.showticklabels,
82085
82159
  tickfont: fontAttrs({
82086
82160
  }),
@@ -90610,7 +90684,7 @@ function getSortFunc(opts, d2c) {
90610
90684
  'use strict';
90611
90685
 
90612
90686
  // package version injected by `npm run preprocess`
90613
- exports.version = '2.8.0';
90687
+ exports.version = '2.9.0';
90614
90688
 
90615
90689
  },{}]},{},[12])(12)
90616
90690
  });