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 (strict) v2.8.0
3
- * Copyright 2012-2021, Plotly, Inc.
2
+ * plotly.js (strict) v2.9.0
3
+ * Copyright 2012-2022, Plotly, Inc.
4
4
  * All rights reserved.
5
5
  * Licensed under the MIT license
6
6
  */
@@ -81040,7 +81040,15 @@ exports.readUInt32BE = function (data, offset) {
81040
81040
 
81041
81041
  function ProbeError(message, code, statusCode) {
81042
81042
  Error.call(this);
81043
- Error.captureStackTrace(this, this.constructor);
81043
+
81044
+ // Include stack trace in error object
81045
+ if (Error.captureStackTrace) {
81046
+ // Chrome and NodeJS
81047
+ Error.captureStackTrace(this, this.constructor);
81048
+ } else {
81049
+ // FF, IE 10+ and Safari 6+. Fallback for others
81050
+ this.stack = (new Error()).stack || '';
81051
+ }
81044
81052
 
81045
81053
  this.name = this.constructor.name;
81046
81054
 
@@ -96832,6 +96840,7 @@ module.exports = overrideAll({
96832
96840
  ticklen: axesAttrs.ticklen,
96833
96841
  tickwidth: axesAttrs.tickwidth,
96834
96842
  tickcolor: axesAttrs.tickcolor,
96843
+ ticklabelstep: axesAttrs.ticklabelstep,
96835
96844
  showticklabels: axesAttrs.showticklabels,
96836
96845
  tickfont: fontAttrs({
96837
96846
  }),
@@ -97922,6 +97931,7 @@ function mockColorBarAxis(gd, opts, zrange) {
97922
97931
  showticklabels: opts.showticklabels,
97923
97932
  ticklabelposition: opts.ticklabelposition,
97924
97933
  ticklabeloverflow: opts.ticklabeloverflow,
97934
+ ticklabelstep: opts.ticklabelstep,
97925
97935
  tickfont: opts.tickfont,
97926
97936
  tickangle: opts.tickangle,
97927
97937
  tickformat: opts.tickformat,
@@ -106728,7 +106738,6 @@ function computeLegendDimensions(gd, groups, traces, legendObj) {
106728
106738
  offsetY += h;
106729
106739
  maxWidthInGroup = Math.max(maxWidthInGroup, textGap + w);
106730
106740
  });
106731
- maxGroupHeightInRow = Math.max(maxGroupHeightInRow, offsetY);
106732
106741
 
106733
106742
  var next = maxWidthInGroup + itemGap;
106734
106743
 
@@ -106744,6 +106753,8 @@ function computeLegendDimensions(gd, groups, traces, legendObj) {
106744
106753
  groupOffsetX = 0;
106745
106754
  groupOffsetY += maxGroupHeightInRow + traceGroupGap;
106746
106755
  maxGroupHeightInRow = offsetY;
106756
+ } else {
106757
+ maxGroupHeightInRow = Math.max(maxGroupHeightInRow, offsetY);
106747
106758
  }
106748
106759
 
106749
106760
  Drawing.setTranslate(this, groupOffsetX, groupOffsetY);
@@ -109226,6 +109237,8 @@ var isNumeric = _dereq_('fast-isnumeric');
109226
109237
 
109227
109238
  var Lib = _dereq_('../../lib');
109228
109239
  var Icons = _dereq_('../../fonts/ploticon');
109240
+ var version = _dereq_('../../version').version;
109241
+
109229
109242
  var Parser = new DOMParser();
109230
109243
 
109231
109244
  /**
@@ -109504,6 +109517,10 @@ proto.hasButtons = function(buttons) {
109504
109517
  return true;
109505
109518
  };
109506
109519
 
109520
+ function jsVersion(str) {
109521
+ return str + ' (v' + version + ')';
109522
+ }
109523
+
109507
109524
  /**
109508
109525
  * @return {HTMLDivElement} The logo image wrapped in a group
109509
109526
  */
@@ -109513,7 +109530,7 @@ proto.getLogo = function() {
109513
109530
 
109514
109531
  a.href = 'https://plotly.com/';
109515
109532
  a.target = '_blank';
109516
- a.setAttribute('data-title', Lib._(this.graphInfo, 'Produced with Plotly'));
109533
+ a.setAttribute('data-title', jsVersion(Lib._(this.graphInfo, 'Produced with Plotly.js')));
109517
109534
  a.className = 'modebar-btn plotlyjsicon modebar-btn--logo';
109518
109535
 
109519
109536
  a.appendChild(this.createIcon(Icons.newplotlylogo));
@@ -109555,7 +109572,7 @@ function createModeBar(gd, buttons) {
109555
109572
 
109556
109573
  module.exports = createModeBar;
109557
109574
 
109558
- },{"../../fonts/ploticon":350,"../../lib":371,"@plotly/d3":53,"fast-isnumeric":99}],300:[function(_dereq_,module,exports){
109575
+ },{"../../fonts/ploticon":350,"../../lib":371,"../../version":933,"@plotly/d3":53,"fast-isnumeric":99}],300:[function(_dereq_,module,exports){
109559
109576
  'use strict';
109560
109577
 
109561
109578
  var fontAttrs = _dereq_('../../plots/font_attributes');
@@ -133687,7 +133704,8 @@ axes.calcTicks = function calcTicks(ax, opts) {
133687
133704
  var minRange = Math.min(rng[0], rng[1]);
133688
133705
  var maxRange = Math.max(rng[0], rng[1]);
133689
133706
 
133690
- var isDLog = (ax.type === 'log') && !(isNumeric(ax.dtick) || ax.dtick.charAt(0) === 'L');
133707
+ var numDtick = isNumeric(ax.dtick);
133708
+ var isDLog = (ax.type === 'log') && !(numDtick || ax.dtick.charAt(0) === 'L');
133691
133709
  var isPeriod = ax.ticklabelmode === 'period';
133692
133710
 
133693
133711
  // find the first tick
@@ -133718,13 +133736,36 @@ axes.calcTicks = function calcTicks(ax, opts) {
133718
133736
  x = axes.tickIncrement(x, ax.dtick, !axrev, ax.calendar);
133719
133737
  }
133720
133738
 
133739
+ var ticklabelstep = ax.ticklabelstep;
133740
+
133721
133741
  var maxTicks = Math.max(1000, ax._length || 0);
133722
133742
  var tickVals = [];
133723
133743
  var xPrevious = null;
133744
+
133745
+ var dTick;
133746
+ if(numDtick) {
133747
+ dTick = ax.dtick;
133748
+ } else {
133749
+ if(ax.type === 'date') {
133750
+ if(typeof ax.dtick === 'string' && ax.dtick.charAt(0) === 'M') {
133751
+ dTick = ONEAVGMONTH * ax.dtick.substring(1);
133752
+ }
133753
+ } else {
133754
+ dTick = ax._roughDTick;
133755
+ }
133756
+ }
133757
+
133758
+ var id = Math.round((
133759
+ ax.r2l(x) -
133760
+ ax.r2l(ax.tick0)
133761
+ ) / dTick) - 1;
133762
+
133724
133763
  for(;
133725
133764
  (axrev) ? (x >= endTick) : (x <= endTick);
133726
133765
  x = axes.tickIncrement(x, ax.dtick, axrev, ax.calendar)
133727
133766
  ) {
133767
+ id++;
133768
+
133728
133769
  if(ax.rangebreaks) {
133729
133770
  if(!axrev) {
133730
133771
  if(x < startTick) continue;
@@ -133742,10 +133783,16 @@ axes.calcTicks = function calcTicks(ax, opts) {
133742
133783
  minor = true;
133743
133784
  }
133744
133785
 
133745
- tickVals.push({
133786
+ var obj = {
133746
133787
  minor: minor,
133747
133788
  value: x
133748
- });
133789
+ };
133790
+
133791
+ if(ticklabelstep > 1 && id % ticklabelstep) {
133792
+ obj.skipLabel = true;
133793
+ }
133794
+
133795
+ tickVals.push(obj);
133749
133796
  }
133750
133797
 
133751
133798
  if(isPeriod) positionPeriodTicks(tickVals, ax, ax._definedDelta);
@@ -133798,12 +133845,20 @@ axes.calcTicks = function calcTicks(ax, opts) {
133798
133845
  ax._prevDateHead = '';
133799
133846
  ax._inCalcTicks = true;
133800
133847
 
133848
+ var lastVisibleHead;
133849
+ var hideLabel = function(tick) {
133850
+ tick.text = ' '; // don't use an empty string here which can confuse automargin (issue 5132)
133851
+ ax._prevDateHead = lastVisibleHead;
133852
+ };
133853
+
133801
133854
  var ticksOut = [];
133802
133855
  var t, p;
133803
133856
  for(i = 0; i < tickVals.length; i++) {
133804
133857
  var _minor = tickVals[i].minor;
133805
133858
  var _value = tickVals[i].value;
133806
133859
 
133860
+ lastVisibleHead = ax._prevDateHead;
133861
+
133807
133862
  t = axes.tickText(
133808
133863
  ax,
133809
133864
  _value,
@@ -133818,11 +133873,14 @@ axes.calcTicks = function calcTicks(ax, opts) {
133818
133873
  if(p > maxRange) t.periodX = maxRange;
133819
133874
  if(p < minRange) t.periodX = minRange;
133820
133875
 
133821
- t.text = ' '; // don't use an empty string here which can confuse automargin (issue 5132)
133822
- ax._prevDateHead = '';
133876
+ hideLabel(t);
133823
133877
  }
133824
133878
  }
133825
133879
 
133880
+ if(tickVals[i].skipLabel) {
133881
+ hideLabel(t);
133882
+ }
133883
+
133826
133884
  ticksOut.push(t);
133827
133885
  }
133828
133886
 
@@ -135850,6 +135908,7 @@ axes.drawLabels = function(gd, ax, opts) {
135850
135908
  var axId = ax._id;
135851
135909
  var axLetter = axId.charAt(0);
135852
135910
  var cls = opts.cls || axId + 'tick';
135911
+
135853
135912
  var vals = opts.vals;
135854
135913
 
135855
135914
  var labelFns = opts.labelFns;
@@ -140706,6 +140765,12 @@ module.exports = {
140706
140765
  editType: 'ticks',
140707
140766
  impliedEdits: {tickmode: 'linear'},
140708
140767
  },
140768
+ ticklabelstep: {
140769
+ valType: 'integer',
140770
+ min: 1,
140771
+ dflt: 1,
140772
+ editType: 'ticks',
140773
+ },
140709
140774
  tickvals: {
140710
140775
  valType: 'data_array',
140711
140776
  editType: 'ticks',
@@ -143570,6 +143635,14 @@ module.exports = function handleTickLabelDefaults(containerIn, containerOut, coe
143570
143635
  color: dfltFontColor
143571
143636
  });
143572
143637
 
143638
+ if(
143639
+ !options.noTicklabelstep &&
143640
+ axType !== 'multicategory' &&
143641
+ axType !== 'log'
143642
+ ) {
143643
+ coerce('ticklabelstep');
143644
+ }
143645
+
143573
143646
  if(!options.noAng) coerce('tickangle');
143574
143647
 
143575
143648
  if(axType !== 'category') {
@@ -148478,6 +148551,7 @@ module.exports = function supplyLayoutDefaults(layoutIn, layoutOut, options) {
148478
148551
  showGrid: true,
148479
148552
  noTickson: true,
148480
148553
  noTicklabelmode: true,
148554
+ noTicklabelstep: true,
148481
148555
  noTicklabelposition: true,
148482
148556
  noTicklabeloverflow: true,
148483
148557
  bgColor: options.bgColor,
@@ -156320,6 +156394,7 @@ var axisTickAttrs = overrideAll({
156320
156394
  ticklen: axesAttrs.ticklen,
156321
156395
  tickwidth: axesAttrs.tickwidth,
156322
156396
  tickcolor: axesAttrs.tickcolor,
156397
+ ticklabelstep: axesAttrs.ticklabelstep,
156323
156398
  showticklabels: axesAttrs.showticklabels,
156324
156399
  showtickprefix: axesAttrs.showtickprefix,
156325
156400
  tickprefix: axesAttrs.tickprefix,
@@ -158874,6 +158949,7 @@ var ternaryAxesAttrs = {
158874
158949
  ticklen: axesAttrs.ticklen,
158875
158950
  tickwidth: axesAttrs.tickwidth,
158876
158951
  tickcolor: axesAttrs.tickcolor,
158952
+ ticklabelstep: axesAttrs.ticklabelstep,
158877
158953
  showticklabels: axesAttrs.showticklabels,
158878
158954
  showtickprefix: axesAttrs.showtickprefix,
158879
158955
  tickprefix: axesAttrs.tickprefix,
@@ -163352,12 +163428,14 @@ function calcTexttemplate(fullLayout, cd, index, xa, ya) {
163352
163428
  var trace = cd[0].trace;
163353
163429
  var texttemplate = Lib.castOption(trace, index, 'texttemplate');
163354
163430
  if(!texttemplate) return '';
163431
+ var isHistogram = (trace.type === 'histogram');
163355
163432
  var isWaterfall = (trace.type === 'waterfall');
163356
163433
  var isFunnel = (trace.type === 'funnel');
163434
+ var isHorizontal = trace.orientation === 'h';
163357
163435
 
163358
163436
  var pLetter, pAxis;
163359
163437
  var vLetter, vAxis;
163360
- if(trace.orientation === 'h') {
163438
+ if(isHorizontal) {
163361
163439
  pLetter = 'y';
163362
163440
  pAxis = ya;
163363
163441
  vLetter = 'x';
@@ -163392,6 +163470,11 @@ function calcTexttemplate(fullLayout, cd, index, xa, ya) {
163392
163470
  var pt = {};
163393
163471
  appendArrayPointValue(pt, trace, cdi.i);
163394
163472
 
163473
+ if(isHistogram || pt.x === undefined) pt.x = isHorizontal ? obj.value : obj.label;
163474
+ if(isHistogram || pt.y === undefined) pt.y = isHorizontal ? obj.label : obj.value;
163475
+ if(isHistogram || pt.xLabel === undefined) pt.xLabel = isHorizontal ? obj.valueLabel : obj.labelLabel;
163476
+ if(isHistogram || pt.yLabel === undefined) pt.yLabel = isHorizontal ? obj.labelLabel : obj.valueLabel;
163477
+
163395
163478
  if(isWaterfall) {
163396
163479
  obj.delta = +cdi.rawS || cdi.s;
163397
163480
  obj.deltaLabel = formatNumber(obj.delta);
@@ -166648,6 +166731,7 @@ function mimickAxisDefaults(traceIn, traceOut, fullLayout, dfltColor) {
166648
166731
  var axOut = Template.newContainer(traceOut, axName);
166649
166732
 
166650
166733
  var defaultOptions = {
166734
+ noTicklabelstep: true,
166651
166735
  tickfont: 'x',
166652
166736
  id: axLetter + 'axis',
166653
166737
  letter: axLetter,
@@ -177230,6 +177314,7 @@ module.exports = function(gd, plotinfo, cdheatmaps, heatmapLayer) {
177230
177314
  var font = trace.textfont;
177231
177315
  var fontFamily = font.family;
177232
177316
  var fontSize = font.size;
177317
+ var globalFontSize = gd._fullLayout.font.size;
177233
177318
 
177234
177319
  if(!fontSize || fontSize === 'auto') {
177235
177320
  var minW = Infinity;
@@ -177256,7 +177341,7 @@ module.exports = function(gd, plotinfo, cdheatmaps, heatmapLayer) {
177256
177341
  !isFinite(minW) ||
177257
177342
  !isFinite(minH)
177258
177343
  ) {
177259
- fontSize = 12;
177344
+ fontSize = globalFontSize;
177260
177345
  } else {
177261
177346
  minW -= xGap;
177262
177347
  minH -= yGap;
@@ -177269,7 +177354,8 @@ module.exports = function(gd, plotinfo, cdheatmaps, heatmapLayer) {
177269
177354
 
177270
177355
  fontSize = Math.min(
177271
177356
  Math.floor(minW),
177272
- Math.floor(minH)
177357
+ Math.floor(minH),
177358
+ globalFontSize
177273
177359
  );
177274
177360
  }
177275
177361
  }
@@ -178157,8 +178243,9 @@ var getBinSpanLabelRound = _dereq_('./bin_label_vals');
178157
178243
  function calc(gd, trace) {
178158
178244
  var pos = [];
178159
178245
  var size = [];
178160
- var pa = Axes.getFromId(gd, trace.orientation === 'h' ? trace.yaxis : trace.xaxis);
178161
- var mainData = trace.orientation === 'h' ? 'y' : 'x';
178246
+ var isHorizontal = trace.orientation === 'h';
178247
+ var pa = Axes.getFromId(gd, isHorizontal ? trace.yaxis : trace.xaxis);
178248
+ var mainData = isHorizontal ? 'y' : 'x';
178162
178249
  var counterData = {x: 'y', y: 'x'}[mainData];
178163
178250
  var calendar = trace[mainData + 'calendar'];
178164
178251
  var cumulativeSpec = trace.cumulative;
@@ -181165,6 +181252,7 @@ module.exports = {
181165
181252
  ticklen: axesAttrs.ticklen,
181166
181253
  tickwidth: axesAttrs.tickwidth,
181167
181254
  tickcolor: axesAttrs.tickcolor,
181255
+ ticklabelstep: axesAttrs.ticklabelstep,
181168
181256
  showticklabels: axesAttrs.showticklabels,
181169
181257
  tickfont: fontAttrs({
181170
181258
  }),
@@ -208357,7 +208445,7 @@ function getSortFunc(opts, d2c) {
208357
208445
  'use strict';
208358
208446
 
208359
208447
  // package version injected by `npm run preprocess`
208360
- exports.version = '2.8.0';
208448
+ exports.version = '2.9.0';
208361
208449
 
208362
208450
  },{}],934:[function(_dereq_,module,exports){
208363
208451
  (function (global){(function (){