plotly.js 2.6.1 → 2.7.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.
@@ -1,5 +1,5 @@
1
1
  /**
2
- * plotly.js (basic) v2.6.1
2
+ * plotly.js (basic) v2.7.0
3
3
  * Copyright 2012-2021, Plotly, Inc.
4
4
  * All rights reserved.
5
5
  * Licensed under the MIT license
@@ -21963,6 +21963,19 @@ function makeColorBarData(gd) {
21963
21963
  }
21964
21964
 
21965
21965
  function drawColorBar(g, opts, gd) {
21966
+ var len = opts.len;
21967
+ var lenmode = opts.lenmode;
21968
+ var thickness = opts.thickness;
21969
+ var thicknessmode = opts.thicknessmode;
21970
+ var outlinewidth = opts.outlinewidth;
21971
+ var borderwidth = opts.borderwidth;
21972
+ var xanchor = opts.xanchor;
21973
+ var yanchor = opts.yanchor;
21974
+ var xpad = opts.xpad;
21975
+ var ypad = opts.ypad;
21976
+ var optsX = opts.x;
21977
+ var optsY = opts.y;
21978
+
21966
21979
  var fullLayout = gd._fullLayout;
21967
21980
  var gs = fullLayout._size;
21968
21981
 
@@ -21992,42 +22005,41 @@ function drawColorBar(g, opts, gd) {
21992
22005
  // when the colorbar itself is pushing the margins.
21993
22006
  // but then the fractional size is calculated based on the
21994
22007
  // actual graph size, so that the axes will size correctly.
21995
- var thickPx = Math.round(opts.thickness * (opts.thicknessmode === 'fraction' ? gs.w : 1));
22008
+ var thickPx = Math.round(thickness * (thicknessmode === 'fraction' ? gs.w : 1));
21996
22009
  var thickFrac = thickPx / gs.w;
21997
- var lenPx = Math.round(opts.len * (opts.lenmode === 'fraction' ? gs.h : 1));
22010
+ var lenPx = Math.round(len * (lenmode === 'fraction' ? gs.h : 1));
21998
22011
  var lenFrac = lenPx / gs.h;
21999
- var xpadFrac = opts.xpad / gs.w;
22000
- var yExtraPx = (opts.borderwidth + opts.outlinewidth) / 2;
22001
- var ypadFrac = opts.ypad / gs.h;
22012
+ var xpadFrac = xpad / gs.w;
22013
+ var yExtraPx = (borderwidth + outlinewidth) / 2;
22014
+ var ypadFrac = ypad / gs.h;
22002
22015
 
22003
22016
  // x positioning: do it initially just for left anchor,
22004
22017
  // then fix at the end (since we don't know the width yet)
22005
- var xLeft = Math.round(opts.x * gs.w + opts.xpad);
22018
+ var uPx = Math.round(optsX * gs.w + xpad);
22006
22019
  // for dragging... this is getting a little muddled...
22007
- var xLeftFrac = opts.x - thickFrac * ({center: 0.5, right: 1}[opts.xanchor] || 0);
22020
+ var uFrac = optsX - thickFrac * ({center: 0.5, right: 1}[xanchor] || 0);
22008
22021
 
22009
22022
  // y positioning we can do correctly from the start
22010
- var yBottomFrac = opts.y + lenFrac * (({top: -0.5, bottom: 0.5}[opts.yanchor] || 0) - 0.5);
22011
- var yBottomPx = Math.round(gs.h * (1 - yBottomFrac));
22012
- var yTopPx = yBottomPx - lenPx;
22023
+ var vFrac = optsY + lenFrac * (({top: -0.5, bottom: 0.5}[yanchor] || 0) - 0.5);
22024
+ var vPx = Math.round(gs.h * (1 - vFrac));
22013
22025
 
22014
22026
  // stash a few things for makeEditable
22015
22027
  opts._lenFrac = lenFrac;
22016
22028
  opts._thickFrac = thickFrac;
22017
- opts._xLeftFrac = xLeftFrac;
22018
- opts._yBottomFrac = yBottomFrac;
22029
+ opts._uFrac = uFrac;
22030
+ opts._vFrac = vFrac;
22019
22031
 
22020
22032
  // stash mocked axis for contour label formatting
22021
22033
  var ax = opts._axis = mockColorBarAxis(gd, opts, zrange);
22022
22034
 
22023
22035
  // position can't go in through supplyDefaults
22024
22036
  // because that restricts it to [0,1]
22025
- ax.position = opts.x + xpadFrac + thickFrac;
22037
+ ax.position = optsX + xpadFrac + thickFrac;
22026
22038
 
22027
22039
  if(['top', 'bottom'].indexOf(titleSide) !== -1) {
22028
22040
  ax.title.side = titleSide;
22029
- ax.titlex = opts.x + xpadFrac;
22030
- ax.titley = yBottomFrac + (title.side === 'top' ? lenFrac - ypadFrac : ypadFrac);
22041
+ ax.titlex = optsX + xpadFrac;
22042
+ ax.titley = vFrac + (title.side === 'top' ? lenFrac - ypadFrac : ypadFrac);
22031
22043
  }
22032
22044
 
22033
22045
  if(line.color && opts.tickmode === 'auto') {
@@ -22035,7 +22047,7 @@ function drawColorBar(g, opts, gd) {
22035
22047
  ax.tick0 = levelsIn.start;
22036
22048
  var dtick = levelsIn.size;
22037
22049
  // expand if too many contours, so we don't get too many ticks
22038
- var autoNtick = Lib.constrain((yBottomPx - yTopPx) / 50, 4, 15) + 1;
22050
+ var autoNtick = Lib.constrain(lenPx / 50, 4, 15) + 1;
22039
22051
  var dtFactor = (zrange[1] - zrange[0]) / ((opts.nticks || autoNtick) * dtick);
22040
22052
  if(dtFactor > 1) {
22041
22053
  var dtexp = Math.pow(10, Math.floor(Math.log(dtFactor) / Math.LN10));
@@ -22053,8 +22065,8 @@ function drawColorBar(g, opts, gd) {
22053
22065
  // set domain after init, because we may want to
22054
22066
  // allow it outside [0,1]
22055
22067
  ax.domain = [
22056
- yBottomFrac + ypadFrac,
22057
- yBottomFrac + lenFrac - ypadFrac
22068
+ vFrac + ypadFrac,
22069
+ vFrac + lenFrac - ypadFrac
22058
22070
  ];
22059
22071
 
22060
22072
  ax.setScale();
@@ -22095,15 +22107,15 @@ function drawColorBar(g, opts, gd) {
22095
22107
  // draw the title so we know how much room it needs
22096
22108
  // when we squish the axis. This one only applies to
22097
22109
  // top or bottom titles, not right side.
22098
- var x = gs.l + (opts.x + xpadFrac) * gs.w;
22110
+ var x = gs.l + (optsX + xpadFrac) * gs.w;
22099
22111
  var fontSize = ax.title.font.size;
22100
22112
  var y;
22101
22113
 
22102
22114
  if(titleSide === 'top') {
22103
- y = (1 - (yBottomFrac + lenFrac - ypadFrac)) * gs.h +
22115
+ y = (1 - (vFrac + lenFrac - ypadFrac)) * gs.h +
22104
22116
  gs.t + 3 + fontSize * 0.75;
22105
22117
  } else {
22106
- y = (1 - (yBottomFrac + ypadFrac)) * gs.h +
22118
+ y = (1 - (vFrac + ypadFrac)) * gs.h +
22107
22119
  gs.t - 3 - fontSize * 0.25;
22108
22120
  }
22109
22121
  drawTitle(ax._id + 'title', {
@@ -22142,7 +22154,7 @@ function drawColorBar(g, opts, gd) {
22142
22154
  // squish the axis top to make room for the title
22143
22155
  var titleGroup = g.select('.' + cn.cbtitle);
22144
22156
  var titleText = titleGroup.select('text');
22145
- var titleTrans = [-opts.outlinewidth / 2, opts.outlinewidth / 2];
22157
+ var titleTrans = [-outlinewidth / 2, outlinewidth / 2];
22146
22158
  var mathJaxNode = titleGroup
22147
22159
  .select('.h' + ax._id + 'title-math-group')
22148
22160
  .node();
@@ -22214,7 +22226,7 @@ function drawColorBar(g, opts, gd) {
22214
22226
  // Colorbar cannot currently support opacities so we
22215
22227
  // use an opaque fill even when alpha channels present
22216
22228
  var fillEl = d3.select(this).attr({
22217
- x: xLeft,
22229
+ x: uPx,
22218
22230
  width: Math.max(thickPx, 2),
22219
22231
  y: d3.min(z),
22220
22232
  height: Math.max(d3.max(z) - d3.min(z), 2),
@@ -22238,7 +22250,7 @@ function drawColorBar(g, opts, gd) {
22238
22250
  lines.exit().remove();
22239
22251
  lines.each(function(d) {
22240
22252
  d3.select(this)
22241
- .attr('d', 'M' + xLeft + ',' +
22253
+ .attr('d', 'M' + uPx + ',' +
22242
22254
  (Math.round(ax.c2p(d)) + (line.width / 2) % 1) + 'h' + thickPx)
22243
22255
  .call(Drawing.lineGroupStyle, line.width, lineColormap(d), line.dash);
22244
22256
  });
@@ -22246,8 +22258,8 @@ function drawColorBar(g, opts, gd) {
22246
22258
  // force full redraw of labels and ticks
22247
22259
  axLayer.selectAll('g.' + ax._id + 'tick,path').remove();
22248
22260
 
22249
- var shift = xLeft + thickPx +
22250
- (opts.outlinewidth || 0) / 2 - (opts.ticks === 'outside' ? 1 : 0);
22261
+ var shift = uPx + thickPx +
22262
+ (outlinewidth || 0) / 2 - (opts.ticks === 'outside' ? 1 : 0);
22251
22263
 
22252
22264
  var vals = Axes.calcTicks(ax);
22253
22265
  var tickSign = Axes.getTickSigns(ax)[2];
@@ -22272,9 +22284,9 @@ function drawColorBar(g, opts, gd) {
22272
22284
  // TODO: why are we redrawing multiple times now with this?
22273
22285
  // I guess autoMargin doesn't like being post-promise?
22274
22286
  function positionCB() {
22275
- var innerWidth = thickPx + opts.outlinewidth / 2;
22287
+ var innerThickness = thickPx + outlinewidth / 2;
22276
22288
  if(ax.ticklabelposition.indexOf('inside') === -1) {
22277
- innerWidth += Drawing.bBox(axLayer.node()).width;
22289
+ innerThickness += Drawing.bBox(axLayer.node()).width;
22278
22290
  }
22279
22291
 
22280
22292
  titleEl = titleCont.select('text');
@@ -22289,66 +22301,65 @@ function drawColorBar(g, opts, gd) {
22289
22301
  // (except for top/bottom mathjax, above)
22290
22302
  // but the weird gs.l is because the titleunshift
22291
22303
  // transform gets removed by Drawing.bBox
22292
- titleWidth = Drawing.bBox(titleCont.node()).right - xLeft - gs.l;
22304
+ titleWidth = Drawing.bBox(titleCont.node()).right - uPx - gs.l;
22293
22305
  }
22294
- innerWidth = Math.max(innerWidth, titleWidth);
22306
+ innerThickness = Math.max(innerThickness, titleWidth);
22295
22307
  }
22296
22308
 
22297
- var outerwidth = 2 * opts.xpad + innerWidth + opts.borderwidth + opts.outlinewidth / 2;
22298
- var outerheight = yBottomPx - yTopPx;
22309
+ var outerThickness = 2 * xpad + innerThickness + borderwidth + outlinewidth / 2;
22299
22310
 
22300
22311
  g.select('.' + cn.cbbg).attr({
22301
- x: xLeft - opts.xpad - (opts.borderwidth + opts.outlinewidth) / 2,
22302
- y: yTopPx - yExtraPx,
22303
- width: Math.max(outerwidth, 2),
22304
- height: Math.max(outerheight + 2 * yExtraPx, 2)
22312
+ x: uPx - xpad - (borderwidth + outlinewidth) / 2,
22313
+ y: vPx - lenPx - yExtraPx,
22314
+ width: Math.max(outerThickness, 2),
22315
+ height: Math.max(lenPx + 2 * yExtraPx, 2)
22305
22316
  })
22306
22317
  .call(Color.fill, opts.bgcolor)
22307
22318
  .call(Color.stroke, opts.bordercolor)
22308
- .style('stroke-width', opts.borderwidth);
22319
+ .style('stroke-width', borderwidth);
22309
22320
 
22310
22321
  g.selectAll('.' + cn.cboutline).attr({
22311
- x: xLeft,
22312
- y: yTopPx + opts.ypad + (titleSide === 'top' ? titleHeight : 0),
22322
+ x: uPx,
22323
+ y: vPx - lenPx + ypad + (titleSide === 'top' ? titleHeight : 0),
22313
22324
  width: Math.max(thickPx, 2),
22314
- height: Math.max(outerheight - 2 * opts.ypad - titleHeight, 2)
22325
+ height: Math.max(lenPx - 2 * ypad - titleHeight, 2)
22315
22326
  })
22316
22327
  .call(Color.stroke, opts.outlinecolor)
22317
22328
  .style({
22318
22329
  fill: 'none',
22319
- 'stroke-width': opts.outlinewidth
22330
+ 'stroke-width': outlinewidth
22320
22331
  });
22321
22332
 
22322
22333
  // fix positioning for xanchor!='left'
22323
- var xoffset = ({center: 0.5, right: 1}[opts.xanchor] || 0) * outerwidth;
22334
+ var xoffset = ({center: 0.5, right: 1}[xanchor] || 0) * outerThickness;
22324
22335
  g.attr('transform', strTranslate(gs.l - xoffset, gs.t));
22325
22336
 
22326
22337
  // auto margin adjustment
22327
22338
  var marginOpts = {};
22328
- var tFrac = FROM_TL[opts.yanchor];
22329
- var bFrac = FROM_BR[opts.yanchor];
22330
- if(opts.lenmode === 'pixels') {
22331
- marginOpts.y = opts.y;
22332
- marginOpts.t = outerheight * tFrac;
22333
- marginOpts.b = outerheight * bFrac;
22339
+ var tFrac = FROM_TL[yanchor];
22340
+ var bFrac = FROM_BR[yanchor];
22341
+ if(lenmode === 'pixels') {
22342
+ marginOpts.y = optsY;
22343
+ marginOpts.t = lenPx * tFrac;
22344
+ marginOpts.b = lenPx * bFrac;
22334
22345
  } else {
22335
22346
  marginOpts.t = marginOpts.b = 0;
22336
- marginOpts.yt = opts.y + opts.len * tFrac;
22337
- marginOpts.yb = opts.y - opts.len * bFrac;
22347
+ marginOpts.yt = optsY + len * tFrac;
22348
+ marginOpts.yb = optsY - len * bFrac;
22338
22349
  }
22339
22350
 
22340
- var lFrac = FROM_TL[opts.xanchor];
22341
- var rFrac = FROM_BR[opts.xanchor];
22342
- if(opts.thicknessmode === 'pixels') {
22343
- marginOpts.x = opts.x;
22344
- marginOpts.l = outerwidth * lFrac;
22345
- marginOpts.r = outerwidth * rFrac;
22351
+ var lFrac = FROM_TL[xanchor];
22352
+ var rFrac = FROM_BR[xanchor];
22353
+ if(thicknessmode === 'pixels') {
22354
+ marginOpts.x = optsX;
22355
+ marginOpts.l = outerThickness * lFrac;
22356
+ marginOpts.r = outerThickness * rFrac;
22346
22357
  } else {
22347
- var extraThickness = outerwidth - thickPx;
22358
+ var extraThickness = outerThickness - thickPx;
22348
22359
  marginOpts.l = extraThickness * lFrac;
22349
22360
  marginOpts.r = extraThickness * rFrac;
22350
- marginOpts.xl = opts.x - opts.thickness * lFrac;
22351
- marginOpts.xr = opts.x + opts.thickness * rFrac;
22361
+ marginOpts.xl = optsX - thickness * lFrac;
22362
+ marginOpts.xr = optsX + thickness * rFrac;
22352
22363
  }
22353
22364
 
22354
22365
  Plots.autoMargin(gd, opts._id, marginOpts);
@@ -22379,9 +22390,9 @@ function makeEditable(g, opts, gd) {
22379
22390
  moveFn: function(dx, dy) {
22380
22391
  g.attr('transform', t0 + strTranslate(dx, dy));
22381
22392
 
22382
- xf = dragElement.align(opts._xLeftFrac + (dx / gs.w), opts._thickFrac,
22393
+ xf = dragElement.align(opts._uFrac + (dx / gs.w), opts._thickFrac,
22383
22394
  0, 1, opts.xanchor);
22384
- yf = dragElement.align(opts._yBottomFrac - (dy / gs.h), opts._lenFrac,
22395
+ yf = dragElement.align(opts._vFrac - (dy / gs.h), opts._lenFrac,
22385
22396
  0, 1, opts.yanchor);
22386
22397
 
22387
22398
  var csr = dragElement.getCursor(xf, yf, opts.xanchor, opts.yanchor);
@@ -24960,7 +24971,7 @@ var TEXTOFFSETSIGN = {
24960
24971
  start: 1, end: -1, middle: 0, bottom: 1, top: -1
24961
24972
  };
24962
24973
 
24963
- function textPointPosition(s, textPosition, fontSize, markerRadius) {
24974
+ function textPointPosition(s, textPosition, fontSize, markerRadius, dontTouchParent) {
24964
24975
  var group = d3.select(s.node().parentNode);
24965
24976
 
24966
24977
  var v = textPosition.indexOf('top') !== -1 ?
@@ -24982,7 +24993,9 @@ function textPointPosition(s, textPosition, fontSize, markerRadius) {
24982
24993
 
24983
24994
  // fix the overall text group position
24984
24995
  s.attr('text-anchor', h);
24985
- group.attr('transform', strTranslate(dx, dy));
24996
+ if(!dontTouchParent) {
24997
+ group.attr('transform', strTranslate(dx, dy));
24998
+ }
24986
24999
  }
24987
25000
 
24988
25001
  function extracTextFontSize(d, trace) {
@@ -25052,7 +25065,8 @@ drawing.selectedTextStyle = function(s, trace) {
25052
25065
  var fontSize = extracTextFontSize(d, trace);
25053
25066
 
25054
25067
  Color.fill(tx, tc);
25055
- textPointPosition(tx, tp, fontSize, d.mrc2 || d.mrc);
25068
+ var dontTouchParent = Registry.traceIs(trace, 'bar-like');
25069
+ textPointPosition(tx, tp, fontSize, d.mrc2 || d.mrc, dontTouchParent);
25056
25070
  });
25057
25071
  };
25058
25072
 
@@ -27083,11 +27097,13 @@ var cartesianScatterPoints = {
27083
27097
  // The actual rendering is done by private function _hover.
27084
27098
  exports.hover = function hover(gd, evt, subplot, noHoverEvent) {
27085
27099
  gd = Lib.getGraphDiv(gd);
27086
-
27100
+ // The 'target' property changes when bubbling out of Shadow DOM.
27101
+ // Throttling can delay reading the target, so we save the current value.
27102
+ var eventTarget = evt.target;
27087
27103
  Lib.throttle(
27088
27104
  gd._fullLayout._uid + constants.HOVERID,
27089
27105
  constants.HOVERMINTIME,
27090
- function() { _hover(gd, evt, subplot, noHoverEvent); }
27106
+ function() { _hover(gd, evt, subplot, noHoverEvent, eventTarget); }
27091
27107
  );
27092
27108
  };
27093
27109
 
@@ -27252,7 +27268,7 @@ exports.loneHover = function loneHover(hoverItems, opts) {
27252
27268
  };
27253
27269
 
27254
27270
  // The actual implementation is here:
27255
- function _hover(gd, evt, subplot, noHoverEvent) {
27271
+ function _hover(gd, evt, subplot, noHoverEvent, eventTarget) {
27256
27272
  if(!subplot) subplot = 'xy';
27257
27273
 
27258
27274
  // if the user passed in an array of subplots,
@@ -27371,7 +27387,7 @@ function _hover(gd, evt, subplot, noHoverEvent) {
27371
27387
  // [x|y]px: the pixels (from top left) of the mouse location
27372
27388
  // on the currently selected plot area
27373
27389
  // add pointerX|Y property for drawing the spikes in spikesnap 'cursor' situation
27374
- var hasUserCalledHover = !evt.target;
27390
+ var hasUserCalledHover = !eventTarget;
27375
27391
  var xpx, ypx;
27376
27392
 
27377
27393
  if(hasUserCalledHover) {
@@ -27388,13 +27404,7 @@ function _hover(gd, evt, subplot, noHoverEvent) {
27388
27404
  return;
27389
27405
  }
27390
27406
 
27391
- // Discover event target, traversing open shadow roots.
27392
- var target = evt.composedPath && evt.composedPath()[0];
27393
- if(!target) {
27394
- // Fallback for browsers not supporting composedPath
27395
- target = evt.target;
27396
- }
27397
- var dbb = target.getBoundingClientRect();
27407
+ var dbb = eventTarget.getBoundingClientRect();
27398
27408
 
27399
27409
  xpx = evt.clientX - dbb.left;
27400
27410
  ypx = evt.clientY - dbb.top;
@@ -27842,15 +27852,15 @@ function _hover(gd, evt, subplot, noHoverEvent) {
27842
27852
  if(!helpers.isUnifiedHover(hovermode)) {
27843
27853
  hoverAvoidOverlaps(hoverLabels, rotateLabels ? 'xa' : 'ya', fullLayout);
27844
27854
  alignHoverText(hoverLabels, rotateLabels, fullLayout._invScaleX, fullLayout._invScaleY);
27845
- } // TODO: tagName hack is needed to appease geo.js's hack of using evt.target=true
27855
+ } // TODO: tagName hack is needed to appease geo.js's hack of using eventTarget=true
27846
27856
  // we should improve the "fx" API so other plots can use it without these hack.
27847
- if(evt.target && evt.target.tagName) {
27857
+ if(eventTarget && eventTarget.tagName) {
27848
27858
  var hasClickToShow = Registry.getComponentMethod('annotations', 'hasClickToShow')(gd, newhoverdata);
27849
- overrideCursor(d3.select(evt.target), hasClickToShow ? 'pointer' : '');
27859
+ overrideCursor(d3.select(eventTarget), hasClickToShow ? 'pointer' : '');
27850
27860
  }
27851
27861
 
27852
27862
  // don't emit events if called manually
27853
- if(!evt.target || noHoverEvent || !hoverChanged(gd, evt, oldhoverdata)) return;
27863
+ if(!eventTarget || noHoverEvent || !hoverChanged(gd, evt, oldhoverdata)) return;
27854
27864
 
27855
27865
  if(oldhoverdata) {
27856
27866
  gd.emit('plotly_unhover', {
@@ -51147,7 +51157,8 @@ function findUIPattern(key, patternSpecs) {
51147
51157
  var spec = patternSpecs[i];
51148
51158
  var match = key.match(spec.pattern);
51149
51159
  if(match) {
51150
- return {head: match[1], attr: spec.attr};
51160
+ var head = match[1] || '';
51161
+ return {head: head, tail: key.substr(head.length + 1), attr: spec.attr};
51151
51162
  }
51152
51163
  }
51153
51164
  }
@@ -51199,26 +51210,54 @@ function valsMatch(v1, v2) {
51199
51210
 
51200
51211
  function applyUIRevisions(data, layout, oldFullData, oldFullLayout) {
51201
51212
  var layoutPreGUI = oldFullLayout._preGUI;
51202
- var key, revAttr, oldRev, newRev, match, preGUIVal, newNP, newVal;
51213
+ var key, revAttr, oldRev, newRev, match, preGUIVal, newNP, newVal, head, tail;
51203
51214
  var bothInheritAutorange = [];
51215
+ var newAutorangeIn = {};
51204
51216
  var newRangeAccepted = {};
51205
51217
  for(key in layoutPreGUI) {
51206
51218
  match = findUIPattern(key, layoutUIControlPatterns);
51207
51219
  if(match) {
51208
- revAttr = match.attr || (match.head + '.uirevision');
51220
+ head = match.head;
51221
+ tail = match.tail;
51222
+ revAttr = match.attr || (head + '.uirevision');
51209
51223
  oldRev = nestedProperty(oldFullLayout, revAttr).get();
51210
51224
  newRev = oldRev && getNewRev(revAttr, layout);
51225
+
51211
51226
  if(newRev && (newRev === oldRev)) {
51212
51227
  preGUIVal = layoutPreGUI[key];
51213
51228
  if(preGUIVal === null) preGUIVal = undefined;
51214
51229
  newNP = nestedProperty(layout, key);
51215
51230
  newVal = newNP.get();
51231
+
51216
51232
  if(valsMatch(newVal, preGUIVal)) {
51217
- if(newVal === undefined && key.substr(key.length - 9) === 'autorange') {
51218
- bothInheritAutorange.push(key.substr(0, key.length - 10));
51233
+ if(newVal === undefined && tail === 'autorange') {
51234
+ bothInheritAutorange.push(head);
51219
51235
  }
51220
51236
  newNP.set(undefinedToNull(nestedProperty(oldFullLayout, key).get()));
51221
51237
  continue;
51238
+ } else if(tail === 'autorange' || tail.substr(0, 6) === 'range[') {
51239
+ // Special case for (auto)range since we push it back into the layout
51240
+ // so all null should be treated equivalently to autorange: true with any range
51241
+ var pre0 = layoutPreGUI[head + '.range[0]'];
51242
+ var pre1 = layoutPreGUI[head + '.range[1]'];
51243
+ var preAuto = layoutPreGUI[head + '.autorange'];
51244
+ if(preAuto || (preAuto === null && pre0 === null && pre1 === null)) {
51245
+ // Only read the input layout once and stash the result,
51246
+ // so we get it before we start modifying it
51247
+ if(!(head in newAutorangeIn)) {
51248
+ var newContainer = nestedProperty(layout, head).get();
51249
+ newAutorangeIn[head] = newContainer && (
51250
+ newContainer.autorange ||
51251
+ (newContainer.autorange !== false && (
51252
+ !newContainer.range || newContainer.range.length !== 2)
51253
+ )
51254
+ );
51255
+ }
51256
+ if(newAutorangeIn[head]) {
51257
+ newNP.set(undefinedToNull(nestedProperty(oldFullLayout, key).get()));
51258
+ continue;
51259
+ }
51260
+ }
51222
51261
  }
51223
51262
  }
51224
51263
  } else {
@@ -51229,12 +51268,12 @@ function applyUIRevisions(data, layout, oldFullData, oldFullLayout) {
51229
51268
  // so remove it from _preGUI for next time.
51230
51269
  delete layoutPreGUI[key];
51231
51270
 
51232
- if(key.substr(key.length - 8, 6) === 'range[') {
51233
- newRangeAccepted[key.substr(0, key.length - 9)] = 1;
51271
+ if(match && match.tail.substr(0, 6) === 'range[') {
51272
+ newRangeAccepted[match.head] = 1;
51234
51273
  }
51235
51274
  }
51236
51275
 
51237
- // Special logic for `autorange`, since it interacts with `range`:
51276
+ // More special logic for `autorange`, since it interacts with `range`:
51238
51277
  // If the new figure's matching `range` was kept, and `autorange`
51239
51278
  // wasn't supplied explicitly in either the original or the new figure,
51240
51279
  // we shouldn't alter that - but we may just have done that, so fix it.
@@ -75580,7 +75619,7 @@ function appendBarText(gd, plotinfo, bar, cd, i, x0, x1, y0, y1, opts, makeOnCom
75580
75619
  }
75581
75620
 
75582
75621
  transform.fontSize = font.size;
75583
- recordMinTextSize(trace.type, transform, fullLayout);
75622
+ recordMinTextSize(trace.type === 'histogram' ? 'bar' : trace.type, transform, fullLayout);
75584
75623
  calcBar.transform = transform;
75585
75624
 
75586
75625
  transition(textSelection, fullLayout, opts, makeOnCompleteCallback)
@@ -82281,7 +82320,7 @@ function getSortFunc(opts, d2c) {
82281
82320
  'use strict';
82282
82321
 
82283
82322
  // package version injected by `npm run preprocess`
82284
- exports.version = '2.6.1';
82323
+ exports.version = '2.7.0';
82285
82324
 
82286
82325
  },{}]},{},[8])(8)
82287
82326
  });