plotly.js 1.58.0 → 1.58.4

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 (48) hide show
  1. package/CHANGELOG.md +42 -1
  2. package/dist/README.md +25 -25
  3. package/dist/plot-schema.json +15 -15
  4. package/dist/plotly-basic.js +608 -444
  5. package/dist/plotly-basic.min.js +4 -4
  6. package/dist/plotly-cartesian.js +725 -561
  7. package/dist/plotly-cartesian.min.js +4 -4
  8. package/dist/plotly-finance.js +689 -525
  9. package/dist/plotly-finance.min.js +4 -4
  10. package/dist/plotly-geo-assets.js +2 -2
  11. package/dist/plotly-geo.js +612 -448
  12. package/dist/plotly-geo.min.js +4 -4
  13. package/dist/plotly-gl2d.js +790 -626
  14. package/dist/plotly-gl2d.min.js +10 -10
  15. package/dist/plotly-gl3d.js +514 -389
  16. package/dist/plotly-gl3d.min.js +3 -3
  17. package/dist/plotly-mapbox.js +622 -458
  18. package/dist/plotly-mapbox.min.js +4 -4
  19. package/dist/plotly-with-meta.js +988 -856
  20. package/dist/plotly.js +980 -851
  21. package/dist/plotly.min.js +3 -3
  22. package/dist/translation-keys.txt +1 -1
  23. package/package.json +1 -1
  24. package/src/components/colorscale/index.js +1 -1
  25. package/src/components/errorbars/attributes.js +1 -1
  26. package/src/components/fx/hover.js +1 -1
  27. package/src/components/sliders/draw.js +1 -1
  28. package/src/lib/index.js +2 -1
  29. package/src/lib/preserve_drawing_buffer.js +68 -0
  30. package/src/plot_api/plot_api.js +19 -15
  31. package/src/plots/cartesian/autorange.js +33 -64
  32. package/src/plots/cartesian/axes.js +44 -16
  33. package/src/plots/cartesian/axis_ids.js +16 -0
  34. package/src/plots/cartesian/constraints.js +2 -2
  35. package/src/plots/cartesian/layout_attributes.js +4 -1
  36. package/src/plots/gl3d/scene.js +16 -18
  37. package/src/plots/plots.js +61 -22
  38. package/src/plots/polar/polar.js +2 -0
  39. package/src/traces/carpet/attributes.js +2 -2
  40. package/src/traces/carpet/create_i_derivative_evaluator.js +1 -1
  41. package/src/traces/carpet/plot.js +1 -1
  42. package/src/traces/carpet/set_convert.js +2 -2
  43. package/src/traces/carpet/smooth_fill_2d_array.js +1 -1
  44. package/src/traces/parcats/attributes.js +1 -1
  45. package/src/traces/scatter/plot.js +1 -1
  46. package/src/traces/scattercarpet/plot.js +1 -1
  47. package/src/traces/sunburst/calc.js +3 -1
  48. package/src/version.js +1 -1
@@ -1866,8 +1866,13 @@ function initMargins(fullLayout) {
1866
1866
  if(!fullLayout._pushmarginIds) fullLayout._pushmarginIds = {};
1867
1867
  }
1868
1868
 
1869
- var minFinalWidth = 64; // could possibly be exposed as layout.margin.minfinalwidth
1870
- var minFinalHeight = 64; // could possibly be exposed as layout.margin.minfinalheight
1869
+ // non-negotiable - this is the smallest height we will allow users to specify via explicit margins
1870
+ var MIN_SPECIFIED_WIDTH = 2;
1871
+ var MIN_SPECIFIED_HEIGHT = 2;
1872
+
1873
+ // could be exposed as an option - the smallest we will allow automargin to shrink a larger plot
1874
+ var MIN_REDUCED_WIDTH = 64;
1875
+ var MIN_REDUCED_HEIGHT = 64;
1871
1876
 
1872
1877
  /**
1873
1878
  * autoMargin: called by components that may need to expand the margins to
@@ -1888,20 +1893,33 @@ plots.autoMargin = function(gd, id, o) {
1888
1893
  var fullLayout = gd._fullLayout;
1889
1894
  var width = fullLayout.width;
1890
1895
  var height = fullLayout.height;
1896
+ var margin = fullLayout.margin;
1897
+
1898
+ var minFinalWidth = Lib.constrain(
1899
+ width - margin.l - margin.r,
1900
+ MIN_SPECIFIED_WIDTH,
1901
+ MIN_REDUCED_WIDTH
1902
+ );
1903
+
1904
+ var minFinalHeight = Lib.constrain(
1905
+ height - margin.t - margin.b,
1906
+ MIN_SPECIFIED_HEIGHT,
1907
+ MIN_REDUCED_HEIGHT
1908
+ );
1909
+
1891
1910
  var maxSpaceW = Math.max(0, width - minFinalWidth);
1892
1911
  var maxSpaceH = Math.max(0, height - minFinalHeight);
1893
1912
 
1894
1913
  var pushMargin = fullLayout._pushmargin;
1895
1914
  var pushMarginIds = fullLayout._pushmarginIds;
1896
1915
 
1897
- if(fullLayout.margin.autoexpand !== false) {
1916
+ if(margin.autoexpand !== false) {
1898
1917
  if(!o) {
1899
1918
  delete pushMargin[id];
1900
1919
  delete pushMarginIds[id];
1901
1920
  } else {
1902
1921
  var pad = o.pad;
1903
1922
  if(pad === undefined) {
1904
- var margin = fullLayout.margin;
1905
1923
  // if no explicit pad is given, use 12px unless there's a
1906
1924
  // specified margin that's smaller than that
1907
1925
  pad = Math.min(12, margin.l, margin.r, margin.t, margin.b);
@@ -1909,15 +1927,19 @@ plots.autoMargin = function(gd, id, o) {
1909
1927
 
1910
1928
  // if the item is too big, just give it enough automargin to
1911
1929
  // make sure you can still grab it and bring it back
1912
- var rW = (o.l + o.r) / maxSpaceW;
1913
- if(rW > 1) {
1914
- o.l /= rW;
1915
- o.r /= rW;
1930
+ if(maxSpaceW) {
1931
+ var rW = (o.l + o.r) / maxSpaceW;
1932
+ if(rW > 1) {
1933
+ o.l /= rW;
1934
+ o.r /= rW;
1935
+ }
1916
1936
  }
1917
- var rH = (o.t + o.b) / maxSpaceH;
1918
- if(rH > 1) {
1919
- o.t /= rH;
1920
- o.b /= rH;
1937
+ if(maxSpaceH) {
1938
+ var rH = (o.t + o.b) / maxSpaceH;
1939
+ if(rH > 1) {
1940
+ o.t /= rH;
1941
+ o.b /= rH;
1942
+ }
1921
1943
  }
1922
1944
 
1923
1945
  var xl = o.xl !== undefined ? o.xl : o.x;
@@ -1944,8 +1966,6 @@ plots.doAutoMargin = function(gd) {
1944
1966
  var fullLayout = gd._fullLayout;
1945
1967
  var width = fullLayout.width;
1946
1968
  var height = fullLayout.height;
1947
- var maxSpaceW = Math.max(0, width - minFinalWidth);
1948
- var maxSpaceH = Math.max(0, height - minFinalHeight);
1949
1969
 
1950
1970
  if(!fullLayout._size) fullLayout._size = {};
1951
1971
  initMargins(fullLayout);
@@ -2018,16 +2038,35 @@ plots.doAutoMargin = function(gd) {
2018
2038
  }
2019
2039
  }
2020
2040
 
2021
- var rW = (ml + mr) / maxSpaceW;
2022
- if(rW > 1) {
2023
- ml /= rW;
2024
- mr /= rW;
2041
+ var minFinalWidth = Lib.constrain(
2042
+ width - margin.l - margin.r,
2043
+ MIN_SPECIFIED_WIDTH,
2044
+ MIN_REDUCED_WIDTH
2045
+ );
2046
+
2047
+ var minFinalHeight = Lib.constrain(
2048
+ height - margin.t - margin.b,
2049
+ MIN_SPECIFIED_HEIGHT,
2050
+ MIN_REDUCED_HEIGHT
2051
+ );
2052
+
2053
+ var maxSpaceW = Math.max(0, width - minFinalWidth);
2054
+ var maxSpaceH = Math.max(0, height - minFinalHeight);
2055
+
2056
+ if(maxSpaceW) {
2057
+ var rW = (ml + mr) / maxSpaceW;
2058
+ if(rW > 1) {
2059
+ ml /= rW;
2060
+ mr /= rW;
2061
+ }
2025
2062
  }
2026
2063
 
2027
- var rH = (mb + mt) / maxSpaceH;
2028
- if(rH > 1) {
2029
- mb /= rH;
2030
- mt /= rH;
2064
+ if(maxSpaceH) {
2065
+ var rH = (mb + mt) / maxSpaceH;
2066
+ if(rH > 1) {
2067
+ mb /= rH;
2068
+ mt /= rH;
2069
+ }
2031
2070
  }
2032
2071
 
2033
2072
  gs.l = Math.round(ml);
@@ -255,6 +255,8 @@ proto.updateLayout = function(fullLayout, polarLayout) {
255
255
  counterclockwise: 'top',
256
256
  clockwise: 'bottom'
257
257
  }[radialLayout.side],
258
+ // keep track of real side
259
+ _realSide: radialLayout.side,
258
260
  // spans length 1 radius
259
261
  domain: [innerRadius / gs.w, radius / gs.w]
260
262
  });
@@ -37,7 +37,7 @@ module.exports = {
37
37
  editType: 'calc+clearAxisTypes',
38
38
  description: [
39
39
  'A two dimensional array of x coordinates at each carpet point.',
40
- 'If ommitted, the plot is a cheater plot and the xaxis is hidden',
40
+ 'If omitted, the plot is a cheater plot and the xaxis is hidden',
41
41
  'by default.'
42
42
  ].join(' ')
43
43
  },
@@ -109,7 +109,7 @@ module.exports = {
109
109
  editType: 'calc',
110
110
  description: [
111
111
  'The shift applied to each successive row of data in creating a cheater plot.',
112
- 'Only used if `x` is been ommitted.'
112
+ 'Only used if `x` is been omitted.'
113
113
  ].join(' ')
114
114
  },
115
115
  aaxis: axisAttrs,
@@ -19,7 +19,7 @@
19
19
  * Also note that the discontinuity of the derivative is in magnitude only. The direction *is*
20
20
  * continuous across cell boundaries.
21
21
  *
22
- * For example, to compute the derivative of the xcoordinate halfway betwen the 7 and 8th i-gridpoints
22
+ * For example, to compute the derivative of the xcoordinate halfway between the 7 and 8th i-gridpoints
23
23
  * and the 10th and 11th j-gridpoints given bicubic smoothing in both dimensions, you'd write:
24
24
  *
25
25
  * var deriv = createIDerivativeEvaluator([x], 1, 1);
@@ -45,7 +45,7 @@ module.exports = function plot(gd, plotinfo, cdcarpet, carpetLayer) {
45
45
  drawGridLines(xa, ya, minorLayer, aax, 'a', aax._minorgridlines, true);
46
46
  drawGridLines(xa, ya, minorLayer, bax, 'b', bax._minorgridlines, true);
47
47
 
48
- // NB: These are not ommitted if the lines are not active. The joins must be executed
48
+ // NB: These are not omitted if the lines are not active. The joins must be executed
49
49
  // in order for them to get cleaned up without a full redraw
50
50
  drawGridLines(xa, ya, boundaryLayer, aax, 'a-boundary', aax._boundarylines);
51
51
  drawGridLines(xa, ya, boundaryLayer, bax, 'b-boundary', bax._boundarylines);
@@ -215,7 +215,7 @@ module.exports = function setConvert(trace) {
215
215
 
216
216
  var i0 = Math.max(0, Math.min(a.length - 2, i));
217
217
 
218
- // The step (demoninator) is implicitly 1 since that's the grid spacing.
218
+ // The step (denominator) is implicitly 1 since that's the grid spacing.
219
219
  return a[i0 + 1] - a[i0];
220
220
  };
221
221
 
@@ -223,7 +223,7 @@ module.exports = function setConvert(trace) {
223
223
  // See above caveats for dadi which also apply here
224
224
  var j0 = Math.max(0, Math.min(b.length - 2, j));
225
225
 
226
- // The step (demoninator) is implicitly 1 since that's the grid spacing.
226
+ // The step (denominator) is implicitly 1 since that's the grid spacing.
227
227
  return b[j0 + 1] - b[j0];
228
228
  };
229
229
 
@@ -200,7 +200,7 @@ module.exports = function smoothFill2dArray(data, a, b) {
200
200
  overrelaxation = boundaryCnt ? 0 : 0.85;
201
201
 
202
202
  // If there are four non-null neighbors, then we want a simple average without
203
- // overrelaxation. If all the surrouding points are null, then we want the full
203
+ // overrelaxation. If all the surrounding points are null, then we want the full
204
204
  // overrelaxation
205
205
  //
206
206
  // Based on experiments, this actually seems to slow down convergence just a bit.
@@ -75,7 +75,7 @@ module.exports = {
75
75
  ],
76
76
  description: [
77
77
  'This value here applies when hovering over dimensions.',
78
- 'Note tath `*categorycount`, *colorcount* and *bandcolorcount*',
78
+ 'Note that `*categorycount`, *colorcount* and *bandcolorcount*',
79
79
  'are only available when `hoveron` contains the *color* flag'
80
80
  ].join(' ')
81
81
  }),
@@ -491,7 +491,7 @@ function plotOne(gd, idx, plotinfo, cdscatter, cdscatterAll, element, transition
491
491
  join.selectAll('text')
492
492
  .call(Drawing.textPointStyle, trace, gd)
493
493
  .each(function(d) {
494
- // This just *has* to be totally custom becuase of SVG text positioning :(
494
+ // This just *has* to be totally custom because of SVG text positioning :(
495
495
  // It's obviously copied from translatePoint; we just can't use that
496
496
  var x = xa.c2p(d.x);
497
497
  var y = ya.c2p(d.y);
@@ -30,7 +30,7 @@ module.exports = function plot(gd, plotinfoproxy, data, layer) {
30
30
  trace = data[i][0].trace;
31
31
 
32
32
  // Note: .select is adequate but seems to mutate the node data,
33
- // which is at least a bit suprising and causes problems elsewhere
33
+ // which is at least a bit surprising and causes problems elsewhere
34
34
  node = layer.selectAll('g.trace' + trace.uid + ' .js-line');
35
35
 
36
36
  // Note: it would be more efficient if this didn't need to be applied
@@ -258,6 +258,7 @@ exports._runCrossTraceCalc = function(desiredType, gd) {
258
258
  }
259
259
  var dfltColorCount = 0;
260
260
 
261
+ var rootColor;
261
262
  function pickColor(d) {
262
263
  var cdi = d.data.data;
263
264
  var id = cdi.id;
@@ -277,7 +278,7 @@ exports._runCrossTraceCalc = function(desiredType, gd) {
277
278
  }
278
279
  } else {
279
280
  // set root color. no coloring by default.
280
- cdi.color = cdi.trace.root.color;
281
+ cdi.color = rootColor;
281
282
  }
282
283
  }
283
284
  }
@@ -286,6 +287,7 @@ exports._runCrossTraceCalc = function(desiredType, gd) {
286
287
  var cd = calcdata[i];
287
288
  var cd0 = cd[0];
288
289
  if(cd0.trace.type === desiredType && cd0.hierarchy) {
290
+ rootColor = cd0.trace.root.color;
289
291
  cd0.hierarchy.each(pickColor);
290
292
  }
291
293
  }
package/src/version.js CHANGED
@@ -9,4 +9,4 @@
9
9
  'use strict';
10
10
 
11
11
  // package version injected by `npm run preprocess`
12
- exports.version = '1.58.0';
12
+ exports.version = '1.58.4';