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 (finance) v2.6.1
2
+ * plotly.js (finance) v2.7.0
3
3
  * Copyright 2012-2021, Plotly, Inc.
4
4
  * All rights reserved.
5
5
  * Licensed under the MIT license
@@ -23183,6 +23183,19 @@ function makeColorBarData(gd) {
23183
23183
  }
23184
23184
 
23185
23185
  function drawColorBar(g, opts, gd) {
23186
+ var len = opts.len;
23187
+ var lenmode = opts.lenmode;
23188
+ var thickness = opts.thickness;
23189
+ var thicknessmode = opts.thicknessmode;
23190
+ var outlinewidth = opts.outlinewidth;
23191
+ var borderwidth = opts.borderwidth;
23192
+ var xanchor = opts.xanchor;
23193
+ var yanchor = opts.yanchor;
23194
+ var xpad = opts.xpad;
23195
+ var ypad = opts.ypad;
23196
+ var optsX = opts.x;
23197
+ var optsY = opts.y;
23198
+
23186
23199
  var fullLayout = gd._fullLayout;
23187
23200
  var gs = fullLayout._size;
23188
23201
 
@@ -23212,42 +23225,41 @@ function drawColorBar(g, opts, gd) {
23212
23225
  // when the colorbar itself is pushing the margins.
23213
23226
  // but then the fractional size is calculated based on the
23214
23227
  // actual graph size, so that the axes will size correctly.
23215
- var thickPx = Math.round(opts.thickness * (opts.thicknessmode === 'fraction' ? gs.w : 1));
23228
+ var thickPx = Math.round(thickness * (thicknessmode === 'fraction' ? gs.w : 1));
23216
23229
  var thickFrac = thickPx / gs.w;
23217
- var lenPx = Math.round(opts.len * (opts.lenmode === 'fraction' ? gs.h : 1));
23230
+ var lenPx = Math.round(len * (lenmode === 'fraction' ? gs.h : 1));
23218
23231
  var lenFrac = lenPx / gs.h;
23219
- var xpadFrac = opts.xpad / gs.w;
23220
- var yExtraPx = (opts.borderwidth + opts.outlinewidth) / 2;
23221
- var ypadFrac = opts.ypad / gs.h;
23232
+ var xpadFrac = xpad / gs.w;
23233
+ var yExtraPx = (borderwidth + outlinewidth) / 2;
23234
+ var ypadFrac = ypad / gs.h;
23222
23235
 
23223
23236
  // x positioning: do it initially just for left anchor,
23224
23237
  // then fix at the end (since we don't know the width yet)
23225
- var xLeft = Math.round(opts.x * gs.w + opts.xpad);
23238
+ var uPx = Math.round(optsX * gs.w + xpad);
23226
23239
  // for dragging... this is getting a little muddled...
23227
- var xLeftFrac = opts.x - thickFrac * ({center: 0.5, right: 1}[opts.xanchor] || 0);
23240
+ var uFrac = optsX - thickFrac * ({center: 0.5, right: 1}[xanchor] || 0);
23228
23241
 
23229
23242
  // y positioning we can do correctly from the start
23230
- var yBottomFrac = opts.y + lenFrac * (({top: -0.5, bottom: 0.5}[opts.yanchor] || 0) - 0.5);
23231
- var yBottomPx = Math.round(gs.h * (1 - yBottomFrac));
23232
- var yTopPx = yBottomPx - lenPx;
23243
+ var vFrac = optsY + lenFrac * (({top: -0.5, bottom: 0.5}[yanchor] || 0) - 0.5);
23244
+ var vPx = Math.round(gs.h * (1 - vFrac));
23233
23245
 
23234
23246
  // stash a few things for makeEditable
23235
23247
  opts._lenFrac = lenFrac;
23236
23248
  opts._thickFrac = thickFrac;
23237
- opts._xLeftFrac = xLeftFrac;
23238
- opts._yBottomFrac = yBottomFrac;
23249
+ opts._uFrac = uFrac;
23250
+ opts._vFrac = vFrac;
23239
23251
 
23240
23252
  // stash mocked axis for contour label formatting
23241
23253
  var ax = opts._axis = mockColorBarAxis(gd, opts, zrange);
23242
23254
 
23243
23255
  // position can't go in through supplyDefaults
23244
23256
  // because that restricts it to [0,1]
23245
- ax.position = opts.x + xpadFrac + thickFrac;
23257
+ ax.position = optsX + xpadFrac + thickFrac;
23246
23258
 
23247
23259
  if(['top', 'bottom'].indexOf(titleSide) !== -1) {
23248
23260
  ax.title.side = titleSide;
23249
- ax.titlex = opts.x + xpadFrac;
23250
- ax.titley = yBottomFrac + (title.side === 'top' ? lenFrac - ypadFrac : ypadFrac);
23261
+ ax.titlex = optsX + xpadFrac;
23262
+ ax.titley = vFrac + (title.side === 'top' ? lenFrac - ypadFrac : ypadFrac);
23251
23263
  }
23252
23264
 
23253
23265
  if(line.color && opts.tickmode === 'auto') {
@@ -23255,7 +23267,7 @@ function drawColorBar(g, opts, gd) {
23255
23267
  ax.tick0 = levelsIn.start;
23256
23268
  var dtick = levelsIn.size;
23257
23269
  // expand if too many contours, so we don't get too many ticks
23258
- var autoNtick = Lib.constrain((yBottomPx - yTopPx) / 50, 4, 15) + 1;
23270
+ var autoNtick = Lib.constrain(lenPx / 50, 4, 15) + 1;
23259
23271
  var dtFactor = (zrange[1] - zrange[0]) / ((opts.nticks || autoNtick) * dtick);
23260
23272
  if(dtFactor > 1) {
23261
23273
  var dtexp = Math.pow(10, Math.floor(Math.log(dtFactor) / Math.LN10));
@@ -23273,8 +23285,8 @@ function drawColorBar(g, opts, gd) {
23273
23285
  // set domain after init, because we may want to
23274
23286
  // allow it outside [0,1]
23275
23287
  ax.domain = [
23276
- yBottomFrac + ypadFrac,
23277
- yBottomFrac + lenFrac - ypadFrac
23288
+ vFrac + ypadFrac,
23289
+ vFrac + lenFrac - ypadFrac
23278
23290
  ];
23279
23291
 
23280
23292
  ax.setScale();
@@ -23315,15 +23327,15 @@ function drawColorBar(g, opts, gd) {
23315
23327
  // draw the title so we know how much room it needs
23316
23328
  // when we squish the axis. This one only applies to
23317
23329
  // top or bottom titles, not right side.
23318
- var x = gs.l + (opts.x + xpadFrac) * gs.w;
23330
+ var x = gs.l + (optsX + xpadFrac) * gs.w;
23319
23331
  var fontSize = ax.title.font.size;
23320
23332
  var y;
23321
23333
 
23322
23334
  if(titleSide === 'top') {
23323
- y = (1 - (yBottomFrac + lenFrac - ypadFrac)) * gs.h +
23335
+ y = (1 - (vFrac + lenFrac - ypadFrac)) * gs.h +
23324
23336
  gs.t + 3 + fontSize * 0.75;
23325
23337
  } else {
23326
- y = (1 - (yBottomFrac + ypadFrac)) * gs.h +
23338
+ y = (1 - (vFrac + ypadFrac)) * gs.h +
23327
23339
  gs.t - 3 - fontSize * 0.25;
23328
23340
  }
23329
23341
  drawTitle(ax._id + 'title', {
@@ -23362,7 +23374,7 @@ function drawColorBar(g, opts, gd) {
23362
23374
  // squish the axis top to make room for the title
23363
23375
  var titleGroup = g.select('.' + cn.cbtitle);
23364
23376
  var titleText = titleGroup.select('text');
23365
- var titleTrans = [-opts.outlinewidth / 2, opts.outlinewidth / 2];
23377
+ var titleTrans = [-outlinewidth / 2, outlinewidth / 2];
23366
23378
  var mathJaxNode = titleGroup
23367
23379
  .select('.h' + ax._id + 'title-math-group')
23368
23380
  .node();
@@ -23434,7 +23446,7 @@ function drawColorBar(g, opts, gd) {
23434
23446
  // Colorbar cannot currently support opacities so we
23435
23447
  // use an opaque fill even when alpha channels present
23436
23448
  var fillEl = d3.select(this).attr({
23437
- x: xLeft,
23449
+ x: uPx,
23438
23450
  width: Math.max(thickPx, 2),
23439
23451
  y: d3.min(z),
23440
23452
  height: Math.max(d3.max(z) - d3.min(z), 2),
@@ -23458,7 +23470,7 @@ function drawColorBar(g, opts, gd) {
23458
23470
  lines.exit().remove();
23459
23471
  lines.each(function(d) {
23460
23472
  d3.select(this)
23461
- .attr('d', 'M' + xLeft + ',' +
23473
+ .attr('d', 'M' + uPx + ',' +
23462
23474
  (Math.round(ax.c2p(d)) + (line.width / 2) % 1) + 'h' + thickPx)
23463
23475
  .call(Drawing.lineGroupStyle, line.width, lineColormap(d), line.dash);
23464
23476
  });
@@ -23466,8 +23478,8 @@ function drawColorBar(g, opts, gd) {
23466
23478
  // force full redraw of labels and ticks
23467
23479
  axLayer.selectAll('g.' + ax._id + 'tick,path').remove();
23468
23480
 
23469
- var shift = xLeft + thickPx +
23470
- (opts.outlinewidth || 0) / 2 - (opts.ticks === 'outside' ? 1 : 0);
23481
+ var shift = uPx + thickPx +
23482
+ (outlinewidth || 0) / 2 - (opts.ticks === 'outside' ? 1 : 0);
23471
23483
 
23472
23484
  var vals = Axes.calcTicks(ax);
23473
23485
  var tickSign = Axes.getTickSigns(ax)[2];
@@ -23492,9 +23504,9 @@ function drawColorBar(g, opts, gd) {
23492
23504
  // TODO: why are we redrawing multiple times now with this?
23493
23505
  // I guess autoMargin doesn't like being post-promise?
23494
23506
  function positionCB() {
23495
- var innerWidth = thickPx + opts.outlinewidth / 2;
23507
+ var innerThickness = thickPx + outlinewidth / 2;
23496
23508
  if(ax.ticklabelposition.indexOf('inside') === -1) {
23497
- innerWidth += Drawing.bBox(axLayer.node()).width;
23509
+ innerThickness += Drawing.bBox(axLayer.node()).width;
23498
23510
  }
23499
23511
 
23500
23512
  titleEl = titleCont.select('text');
@@ -23509,66 +23521,65 @@ function drawColorBar(g, opts, gd) {
23509
23521
  // (except for top/bottom mathjax, above)
23510
23522
  // but the weird gs.l is because the titleunshift
23511
23523
  // transform gets removed by Drawing.bBox
23512
- titleWidth = Drawing.bBox(titleCont.node()).right - xLeft - gs.l;
23524
+ titleWidth = Drawing.bBox(titleCont.node()).right - uPx - gs.l;
23513
23525
  }
23514
- innerWidth = Math.max(innerWidth, titleWidth);
23526
+ innerThickness = Math.max(innerThickness, titleWidth);
23515
23527
  }
23516
23528
 
23517
- var outerwidth = 2 * opts.xpad + innerWidth + opts.borderwidth + opts.outlinewidth / 2;
23518
- var outerheight = yBottomPx - yTopPx;
23529
+ var outerThickness = 2 * xpad + innerThickness + borderwidth + outlinewidth / 2;
23519
23530
 
23520
23531
  g.select('.' + cn.cbbg).attr({
23521
- x: xLeft - opts.xpad - (opts.borderwidth + opts.outlinewidth) / 2,
23522
- y: yTopPx - yExtraPx,
23523
- width: Math.max(outerwidth, 2),
23524
- height: Math.max(outerheight + 2 * yExtraPx, 2)
23532
+ x: uPx - xpad - (borderwidth + outlinewidth) / 2,
23533
+ y: vPx - lenPx - yExtraPx,
23534
+ width: Math.max(outerThickness, 2),
23535
+ height: Math.max(lenPx + 2 * yExtraPx, 2)
23525
23536
  })
23526
23537
  .call(Color.fill, opts.bgcolor)
23527
23538
  .call(Color.stroke, opts.bordercolor)
23528
- .style('stroke-width', opts.borderwidth);
23539
+ .style('stroke-width', borderwidth);
23529
23540
 
23530
23541
  g.selectAll('.' + cn.cboutline).attr({
23531
- x: xLeft,
23532
- y: yTopPx + opts.ypad + (titleSide === 'top' ? titleHeight : 0),
23542
+ x: uPx,
23543
+ y: vPx - lenPx + ypad + (titleSide === 'top' ? titleHeight : 0),
23533
23544
  width: Math.max(thickPx, 2),
23534
- height: Math.max(outerheight - 2 * opts.ypad - titleHeight, 2)
23545
+ height: Math.max(lenPx - 2 * ypad - titleHeight, 2)
23535
23546
  })
23536
23547
  .call(Color.stroke, opts.outlinecolor)
23537
23548
  .style({
23538
23549
  fill: 'none',
23539
- 'stroke-width': opts.outlinewidth
23550
+ 'stroke-width': outlinewidth
23540
23551
  });
23541
23552
 
23542
23553
  // fix positioning for xanchor!='left'
23543
- var xoffset = ({center: 0.5, right: 1}[opts.xanchor] || 0) * outerwidth;
23554
+ var xoffset = ({center: 0.5, right: 1}[xanchor] || 0) * outerThickness;
23544
23555
  g.attr('transform', strTranslate(gs.l - xoffset, gs.t));
23545
23556
 
23546
23557
  // auto margin adjustment
23547
23558
  var marginOpts = {};
23548
- var tFrac = FROM_TL[opts.yanchor];
23549
- var bFrac = FROM_BR[opts.yanchor];
23550
- if(opts.lenmode === 'pixels') {
23551
- marginOpts.y = opts.y;
23552
- marginOpts.t = outerheight * tFrac;
23553
- marginOpts.b = outerheight * bFrac;
23559
+ var tFrac = FROM_TL[yanchor];
23560
+ var bFrac = FROM_BR[yanchor];
23561
+ if(lenmode === 'pixels') {
23562
+ marginOpts.y = optsY;
23563
+ marginOpts.t = lenPx * tFrac;
23564
+ marginOpts.b = lenPx * bFrac;
23554
23565
  } else {
23555
23566
  marginOpts.t = marginOpts.b = 0;
23556
- marginOpts.yt = opts.y + opts.len * tFrac;
23557
- marginOpts.yb = opts.y - opts.len * bFrac;
23567
+ marginOpts.yt = optsY + len * tFrac;
23568
+ marginOpts.yb = optsY - len * bFrac;
23558
23569
  }
23559
23570
 
23560
- var lFrac = FROM_TL[opts.xanchor];
23561
- var rFrac = FROM_BR[opts.xanchor];
23562
- if(opts.thicknessmode === 'pixels') {
23563
- marginOpts.x = opts.x;
23564
- marginOpts.l = outerwidth * lFrac;
23565
- marginOpts.r = outerwidth * rFrac;
23571
+ var lFrac = FROM_TL[xanchor];
23572
+ var rFrac = FROM_BR[xanchor];
23573
+ if(thicknessmode === 'pixels') {
23574
+ marginOpts.x = optsX;
23575
+ marginOpts.l = outerThickness * lFrac;
23576
+ marginOpts.r = outerThickness * rFrac;
23566
23577
  } else {
23567
- var extraThickness = outerwidth - thickPx;
23578
+ var extraThickness = outerThickness - thickPx;
23568
23579
  marginOpts.l = extraThickness * lFrac;
23569
23580
  marginOpts.r = extraThickness * rFrac;
23570
- marginOpts.xl = opts.x - opts.thickness * lFrac;
23571
- marginOpts.xr = opts.x + opts.thickness * rFrac;
23581
+ marginOpts.xl = optsX - thickness * lFrac;
23582
+ marginOpts.xr = optsX + thickness * rFrac;
23572
23583
  }
23573
23584
 
23574
23585
  Plots.autoMargin(gd, opts._id, marginOpts);
@@ -23599,9 +23610,9 @@ function makeEditable(g, opts, gd) {
23599
23610
  moveFn: function(dx, dy) {
23600
23611
  g.attr('transform', t0 + strTranslate(dx, dy));
23601
23612
 
23602
- xf = dragElement.align(opts._xLeftFrac + (dx / gs.w), opts._thickFrac,
23613
+ xf = dragElement.align(opts._uFrac + (dx / gs.w), opts._thickFrac,
23603
23614
  0, 1, opts.xanchor);
23604
- yf = dragElement.align(opts._yBottomFrac - (dy / gs.h), opts._lenFrac,
23615
+ yf = dragElement.align(opts._vFrac - (dy / gs.h), opts._lenFrac,
23605
23616
  0, 1, opts.yanchor);
23606
23617
 
23607
23618
  var csr = dragElement.getCursor(xf, yf, opts.xanchor, opts.yanchor);
@@ -26180,7 +26191,7 @@ var TEXTOFFSETSIGN = {
26180
26191
  start: 1, end: -1, middle: 0, bottom: 1, top: -1
26181
26192
  };
26182
26193
 
26183
- function textPointPosition(s, textPosition, fontSize, markerRadius) {
26194
+ function textPointPosition(s, textPosition, fontSize, markerRadius, dontTouchParent) {
26184
26195
  var group = d3.select(s.node().parentNode);
26185
26196
 
26186
26197
  var v = textPosition.indexOf('top') !== -1 ?
@@ -26202,7 +26213,9 @@ function textPointPosition(s, textPosition, fontSize, markerRadius) {
26202
26213
 
26203
26214
  // fix the overall text group position
26204
26215
  s.attr('text-anchor', h);
26205
- group.attr('transform', strTranslate(dx, dy));
26216
+ if(!dontTouchParent) {
26217
+ group.attr('transform', strTranslate(dx, dy));
26218
+ }
26206
26219
  }
26207
26220
 
26208
26221
  function extracTextFontSize(d, trace) {
@@ -26272,7 +26285,8 @@ drawing.selectedTextStyle = function(s, trace) {
26272
26285
  var fontSize = extracTextFontSize(d, trace);
26273
26286
 
26274
26287
  Color.fill(tx, tc);
26275
- textPointPosition(tx, tp, fontSize, d.mrc2 || d.mrc);
26288
+ var dontTouchParent = Registry.traceIs(trace, 'bar-like');
26289
+ textPointPosition(tx, tp, fontSize, d.mrc2 || d.mrc, dontTouchParent);
26276
26290
  });
26277
26291
  };
26278
26292
 
@@ -28303,11 +28317,13 @@ var cartesianScatterPoints = {
28303
28317
  // The actual rendering is done by private function _hover.
28304
28318
  exports.hover = function hover(gd, evt, subplot, noHoverEvent) {
28305
28319
  gd = Lib.getGraphDiv(gd);
28306
-
28320
+ // The 'target' property changes when bubbling out of Shadow DOM.
28321
+ // Throttling can delay reading the target, so we save the current value.
28322
+ var eventTarget = evt.target;
28307
28323
  Lib.throttle(
28308
28324
  gd._fullLayout._uid + constants.HOVERID,
28309
28325
  constants.HOVERMINTIME,
28310
- function() { _hover(gd, evt, subplot, noHoverEvent); }
28326
+ function() { _hover(gd, evt, subplot, noHoverEvent, eventTarget); }
28311
28327
  );
28312
28328
  };
28313
28329
 
@@ -28472,7 +28488,7 @@ exports.loneHover = function loneHover(hoverItems, opts) {
28472
28488
  };
28473
28489
 
28474
28490
  // The actual implementation is here:
28475
- function _hover(gd, evt, subplot, noHoverEvent) {
28491
+ function _hover(gd, evt, subplot, noHoverEvent, eventTarget) {
28476
28492
  if(!subplot) subplot = 'xy';
28477
28493
 
28478
28494
  // if the user passed in an array of subplots,
@@ -28591,7 +28607,7 @@ function _hover(gd, evt, subplot, noHoverEvent) {
28591
28607
  // [x|y]px: the pixels (from top left) of the mouse location
28592
28608
  // on the currently selected plot area
28593
28609
  // add pointerX|Y property for drawing the spikes in spikesnap 'cursor' situation
28594
- var hasUserCalledHover = !evt.target;
28610
+ var hasUserCalledHover = !eventTarget;
28595
28611
  var xpx, ypx;
28596
28612
 
28597
28613
  if(hasUserCalledHover) {
@@ -28608,13 +28624,7 @@ function _hover(gd, evt, subplot, noHoverEvent) {
28608
28624
  return;
28609
28625
  }
28610
28626
 
28611
- // Discover event target, traversing open shadow roots.
28612
- var target = evt.composedPath && evt.composedPath()[0];
28613
- if(!target) {
28614
- // Fallback for browsers not supporting composedPath
28615
- target = evt.target;
28616
- }
28617
- var dbb = target.getBoundingClientRect();
28627
+ var dbb = eventTarget.getBoundingClientRect();
28618
28628
 
28619
28629
  xpx = evt.clientX - dbb.left;
28620
28630
  ypx = evt.clientY - dbb.top;
@@ -29062,15 +29072,15 @@ function _hover(gd, evt, subplot, noHoverEvent) {
29062
29072
  if(!helpers.isUnifiedHover(hovermode)) {
29063
29073
  hoverAvoidOverlaps(hoverLabels, rotateLabels ? 'xa' : 'ya', fullLayout);
29064
29074
  alignHoverText(hoverLabels, rotateLabels, fullLayout._invScaleX, fullLayout._invScaleY);
29065
- } // TODO: tagName hack is needed to appease geo.js's hack of using evt.target=true
29075
+ } // TODO: tagName hack is needed to appease geo.js's hack of using eventTarget=true
29066
29076
  // we should improve the "fx" API so other plots can use it without these hack.
29067
- if(evt.target && evt.target.tagName) {
29077
+ if(eventTarget && eventTarget.tagName) {
29068
29078
  var hasClickToShow = Registry.getComponentMethod('annotations', 'hasClickToShow')(gd, newhoverdata);
29069
- overrideCursor(d3.select(evt.target), hasClickToShow ? 'pointer' : '');
29079
+ overrideCursor(d3.select(eventTarget), hasClickToShow ? 'pointer' : '');
29070
29080
  }
29071
29081
 
29072
29082
  // don't emit events if called manually
29073
- if(!evt.target || noHoverEvent || !hoverChanged(gd, evt, oldhoverdata)) return;
29083
+ if(!eventTarget || noHoverEvent || !hoverChanged(gd, evt, oldhoverdata)) return;
29074
29084
 
29075
29085
  if(oldhoverdata) {
29076
29086
  gd.emit('plotly_unhover', {
@@ -52381,7 +52391,8 @@ function findUIPattern(key, patternSpecs) {
52381
52391
  var spec = patternSpecs[i];
52382
52392
  var match = key.match(spec.pattern);
52383
52393
  if(match) {
52384
- return {head: match[1], attr: spec.attr};
52394
+ var head = match[1] || '';
52395
+ return {head: head, tail: key.substr(head.length + 1), attr: spec.attr};
52385
52396
  }
52386
52397
  }
52387
52398
  }
@@ -52433,26 +52444,54 @@ function valsMatch(v1, v2) {
52433
52444
 
52434
52445
  function applyUIRevisions(data, layout, oldFullData, oldFullLayout) {
52435
52446
  var layoutPreGUI = oldFullLayout._preGUI;
52436
- var key, revAttr, oldRev, newRev, match, preGUIVal, newNP, newVal;
52447
+ var key, revAttr, oldRev, newRev, match, preGUIVal, newNP, newVal, head, tail;
52437
52448
  var bothInheritAutorange = [];
52449
+ var newAutorangeIn = {};
52438
52450
  var newRangeAccepted = {};
52439
52451
  for(key in layoutPreGUI) {
52440
52452
  match = findUIPattern(key, layoutUIControlPatterns);
52441
52453
  if(match) {
52442
- revAttr = match.attr || (match.head + '.uirevision');
52454
+ head = match.head;
52455
+ tail = match.tail;
52456
+ revAttr = match.attr || (head + '.uirevision');
52443
52457
  oldRev = nestedProperty(oldFullLayout, revAttr).get();
52444
52458
  newRev = oldRev && getNewRev(revAttr, layout);
52459
+
52445
52460
  if(newRev && (newRev === oldRev)) {
52446
52461
  preGUIVal = layoutPreGUI[key];
52447
52462
  if(preGUIVal === null) preGUIVal = undefined;
52448
52463
  newNP = nestedProperty(layout, key);
52449
52464
  newVal = newNP.get();
52465
+
52450
52466
  if(valsMatch(newVal, preGUIVal)) {
52451
- if(newVal === undefined && key.substr(key.length - 9) === 'autorange') {
52452
- bothInheritAutorange.push(key.substr(0, key.length - 10));
52467
+ if(newVal === undefined && tail === 'autorange') {
52468
+ bothInheritAutorange.push(head);
52453
52469
  }
52454
52470
  newNP.set(undefinedToNull(nestedProperty(oldFullLayout, key).get()));
52455
52471
  continue;
52472
+ } else if(tail === 'autorange' || tail.substr(0, 6) === 'range[') {
52473
+ // Special case for (auto)range since we push it back into the layout
52474
+ // so all null should be treated equivalently to autorange: true with any range
52475
+ var pre0 = layoutPreGUI[head + '.range[0]'];
52476
+ var pre1 = layoutPreGUI[head + '.range[1]'];
52477
+ var preAuto = layoutPreGUI[head + '.autorange'];
52478
+ if(preAuto || (preAuto === null && pre0 === null && pre1 === null)) {
52479
+ // Only read the input layout once and stash the result,
52480
+ // so we get it before we start modifying it
52481
+ if(!(head in newAutorangeIn)) {
52482
+ var newContainer = nestedProperty(layout, head).get();
52483
+ newAutorangeIn[head] = newContainer && (
52484
+ newContainer.autorange ||
52485
+ (newContainer.autorange !== false && (
52486
+ !newContainer.range || newContainer.range.length !== 2)
52487
+ )
52488
+ );
52489
+ }
52490
+ if(newAutorangeIn[head]) {
52491
+ newNP.set(undefinedToNull(nestedProperty(oldFullLayout, key).get()));
52492
+ continue;
52493
+ }
52494
+ }
52456
52495
  }
52457
52496
  }
52458
52497
  } else {
@@ -52463,12 +52502,12 @@ function applyUIRevisions(data, layout, oldFullData, oldFullLayout) {
52463
52502
  // so remove it from _preGUI for next time.
52464
52503
  delete layoutPreGUI[key];
52465
52504
 
52466
- if(key.substr(key.length - 8, 6) === 'range[') {
52467
- newRangeAccepted[key.substr(0, key.length - 9)] = 1;
52505
+ if(match && match.tail.substr(0, 6) === 'range[') {
52506
+ newRangeAccepted[match.head] = 1;
52468
52507
  }
52469
52508
  }
52470
52509
 
52471
- // Special logic for `autorange`, since it interacts with `range`:
52510
+ // More special logic for `autorange`, since it interacts with `range`:
52472
52511
  // If the new figure's matching `range` was kept, and `autorange`
52473
52512
  // wasn't supplied explicitly in either the original or the new figure,
52474
52513
  // we shouldn't alter that - but we may just have done that, so fix it.
@@ -76814,7 +76853,7 @@ function appendBarText(gd, plotinfo, bar, cd, i, x0, x1, y0, y1, opts, makeOnCom
76814
76853
  }
76815
76854
 
76816
76855
  transform.fontSize = font.size;
76817
- recordMinTextSize(trace.type, transform, fullLayout);
76856
+ recordMinTextSize(trace.type === 'histogram' ? 'bar' : trace.type, transform, fullLayout);
76818
76857
  calcBar.transform = transform;
76819
76858
 
76820
76859
  transition(textSelection, fullLayout, opts, makeOnCompleteCallback)
@@ -80058,6 +80097,8 @@ module.exports = function style(gd) {
80058
80097
  var barAttrs = _dereq_('../bar/attributes');
80059
80098
  var axisHoverFormat = _dereq_('../../plots/cartesian/axis_format_attributes').axisHoverFormat;
80060
80099
  var hovertemplateAttrs = _dereq_('../../plots/template_attributes').hovertemplateAttrs;
80100
+ var texttemplateAttrs = _dereq_('../../plots/template_attributes').texttemplateAttrs;
80101
+ var fontAttrs = _dereq_('../../plots/font_attributes');
80061
80102
  var makeBinAttrs = _dereq_('./bin_attributes');
80062
80103
  var constants = _dereq_('./constants');
80063
80104
  var extendFlat = _dereq_('../../lib/extend').extendFlat;
@@ -80152,6 +80193,41 @@ module.exports = {
80152
80193
  keys: constants.eventDataKeys
80153
80194
  }),
80154
80195
 
80196
+ texttemplate: texttemplateAttrs({
80197
+ arrayOk: false,
80198
+ editType: 'plot'
80199
+ }, {
80200
+ keys: ['label', 'value']
80201
+ }),
80202
+
80203
+ textposition: extendFlat({}, barAttrs.textposition, {
80204
+ arrayOk: false
80205
+ }),
80206
+
80207
+ textfont: fontAttrs({
80208
+ arrayOk: false,
80209
+ editType: 'plot',
80210
+ colorEditType: 'style',
80211
+ }),
80212
+
80213
+ outsidetextfont: fontAttrs({
80214
+ arrayOk: false,
80215
+ editType: 'plot',
80216
+ colorEditType: 'style',
80217
+ }),
80218
+
80219
+ insidetextfont: fontAttrs({
80220
+ arrayOk: false,
80221
+ editType: 'plot',
80222
+ colorEditType: 'style',
80223
+ }),
80224
+
80225
+ insidetextanchor: barAttrs.insidetextanchor,
80226
+
80227
+ textangle: barAttrs.textangle,
80228
+ cliponaxis: barAttrs.cliponaxis,
80229
+ constraintext: barAttrs.constraintext,
80230
+
80155
80231
  marker: barAttrs.marker,
80156
80232
 
80157
80233
  offsetgroup: barAttrs.offsetgroup,
@@ -80165,7 +80241,7 @@ module.exports = {
80165
80241
  }
80166
80242
  };
80167
80243
 
80168
- },{"../../lib/extend":236,"../../plots/cartesian/axis_format_attributes":292,"../../plots/template_attributes":327,"../bar/attributes":338,"./bin_attributes":389,"./constants":393}],388:[function(_dereq_,module,exports){
80244
+ },{"../../lib/extend":236,"../../plots/cartesian/axis_format_attributes":292,"../../plots/font_attributes":320,"../../plots/template_attributes":327,"../bar/attributes":338,"./bin_attributes":389,"./constants":393}],388:[function(_dereq_,module,exports){
80169
80245
  'use strict';
80170
80246
 
80171
80247
 
@@ -81288,6 +81364,7 @@ var Registry = _dereq_('../../registry');
81288
81364
  var Lib = _dereq_('../../lib');
81289
81365
  var Color = _dereq_('../../components/color');
81290
81366
 
81367
+ var handleText = _dereq_('../bar/defaults').handleText;
81291
81368
  var handleStyleDefaults = _dereq_('../bar/style_defaults');
81292
81369
  var attributes = _dereq_('./attributes');
81293
81370
 
@@ -81306,6 +81383,16 @@ module.exports = function supplyDefaults(traceIn, traceOut, defaultColor, layout
81306
81383
  }
81307
81384
 
81308
81385
  coerce('text');
81386
+ var textposition = coerce('textposition');
81387
+ handleText(traceIn, traceOut, layout, coerce, textposition, {
81388
+ moduleHasSelected: true,
81389
+ moduleHasUnselected: true,
81390
+ moduleHasConstrain: true,
81391
+ moduleHasCliponaxis: true,
81392
+ moduleHasTextangle: true,
81393
+ moduleHasInsideanchor: true
81394
+ });
81395
+
81309
81396
  coerce('hovertext');
81310
81397
  coerce('hovertemplate');
81311
81398
  coerce('xhoverformat');
@@ -81349,7 +81436,7 @@ module.exports = function supplyDefaults(traceIn, traceOut, defaultColor, layout
81349
81436
  errorBarsSupplyDefaults(traceIn, traceOut, lineColor || Color.defaultLine, {axis: 'x', inherit: 'y'});
81350
81437
  };
81351
81438
 
81352
- },{"../../components/color":111,"../../lib":242,"../../registry":328,"../bar/style_defaults":353,"./attributes":387}],396:[function(_dereq_,module,exports){
81439
+ },{"../../components/color":111,"../../lib":242,"../../registry":328,"../bar/defaults":342,"../bar/style_defaults":353,"./attributes":387}],396:[function(_dereq_,module,exports){
81353
81440
  'use strict';
81354
81441
 
81355
81442
  module.exports = function eventData(out, pt, trace, cd, pointNumber) {
@@ -90219,7 +90306,7 @@ function getSortFunc(opts, d2c) {
90219
90306
  'use strict';
90220
90307
 
90221
90308
  // package version injected by `npm run preprocess`
90222
- exports.version = '2.6.1';
90309
+ exports.version = '2.7.0';
90223
90310
 
90224
90311
  },{}]},{},[12])(12)
90225
90312
  });