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 (cartesian) v2.6.1
2
+ * plotly.js (cartesian) v2.7.0
3
3
  * Copyright 2012-2021, Plotly, Inc.
4
4
  * All rights reserved.
5
5
  * Licensed under the MIT license
@@ -16525,15 +16525,18 @@ var SIG_EXIF = str2arr('Exif\0\0');
16525
16525
  module.exports = function (data) {
16526
16526
  if (data.length < 2) return;
16527
16527
 
16528
- // first marker of the file MUST be 0xFFD8
16529
- if (data[0] !== 0xFF || data[1] !== 0xD8) return;
16528
+ // first marker of the file MUST be 0xFFD8,
16529
+ // following by either 0xFFE0, 0xFFE2 or 0xFFE3
16530
+ if (data[0] !== 0xFF || data[1] !== 0xD8 || data[2] !== 0xFF) return;
16530
16531
 
16531
16532
  var offset = 2;
16532
16533
 
16533
16534
  for (;;) {
16534
- if (data.length - offset < 2) return;
16535
- // not a JPEG marker
16536
- if (data[offset++] !== 0xFF) return;
16535
+ // skip until we see 0xFF, see https://github.com/nodeca/probe-image-size/issues/68
16536
+ for (;;) {
16537
+ if (data.length - offset < 2) return;
16538
+ if (data[offset++] === 0xFF) break;
16539
+ }
16537
16540
 
16538
16541
  var code = data[offset++];
16539
16542
  var length;
@@ -31122,6 +31125,19 @@ function makeColorBarData(gd) {
31122
31125
  }
31123
31126
 
31124
31127
  function drawColorBar(g, opts, gd) {
31128
+ var len = opts.len;
31129
+ var lenmode = opts.lenmode;
31130
+ var thickness = opts.thickness;
31131
+ var thicknessmode = opts.thicknessmode;
31132
+ var outlinewidth = opts.outlinewidth;
31133
+ var borderwidth = opts.borderwidth;
31134
+ var xanchor = opts.xanchor;
31135
+ var yanchor = opts.yanchor;
31136
+ var xpad = opts.xpad;
31137
+ var ypad = opts.ypad;
31138
+ var optsX = opts.x;
31139
+ var optsY = opts.y;
31140
+
31125
31141
  var fullLayout = gd._fullLayout;
31126
31142
  var gs = fullLayout._size;
31127
31143
 
@@ -31151,42 +31167,41 @@ function drawColorBar(g, opts, gd) {
31151
31167
  // when the colorbar itself is pushing the margins.
31152
31168
  // but then the fractional size is calculated based on the
31153
31169
  // actual graph size, so that the axes will size correctly.
31154
- var thickPx = Math.round(opts.thickness * (opts.thicknessmode === 'fraction' ? gs.w : 1));
31170
+ var thickPx = Math.round(thickness * (thicknessmode === 'fraction' ? gs.w : 1));
31155
31171
  var thickFrac = thickPx / gs.w;
31156
- var lenPx = Math.round(opts.len * (opts.lenmode === 'fraction' ? gs.h : 1));
31172
+ var lenPx = Math.round(len * (lenmode === 'fraction' ? gs.h : 1));
31157
31173
  var lenFrac = lenPx / gs.h;
31158
- var xpadFrac = opts.xpad / gs.w;
31159
- var yExtraPx = (opts.borderwidth + opts.outlinewidth) / 2;
31160
- var ypadFrac = opts.ypad / gs.h;
31174
+ var xpadFrac = xpad / gs.w;
31175
+ var yExtraPx = (borderwidth + outlinewidth) / 2;
31176
+ var ypadFrac = ypad / gs.h;
31161
31177
 
31162
31178
  // x positioning: do it initially just for left anchor,
31163
31179
  // then fix at the end (since we don't know the width yet)
31164
- var xLeft = Math.round(opts.x * gs.w + opts.xpad);
31180
+ var uPx = Math.round(optsX * gs.w + xpad);
31165
31181
  // for dragging... this is getting a little muddled...
31166
- var xLeftFrac = opts.x - thickFrac * ({center: 0.5, right: 1}[opts.xanchor] || 0);
31182
+ var uFrac = optsX - thickFrac * ({center: 0.5, right: 1}[xanchor] || 0);
31167
31183
 
31168
31184
  // y positioning we can do correctly from the start
31169
- var yBottomFrac = opts.y + lenFrac * (({top: -0.5, bottom: 0.5}[opts.yanchor] || 0) - 0.5);
31170
- var yBottomPx = Math.round(gs.h * (1 - yBottomFrac));
31171
- var yTopPx = yBottomPx - lenPx;
31185
+ var vFrac = optsY + lenFrac * (({top: -0.5, bottom: 0.5}[yanchor] || 0) - 0.5);
31186
+ var vPx = Math.round(gs.h * (1 - vFrac));
31172
31187
 
31173
31188
  // stash a few things for makeEditable
31174
31189
  opts._lenFrac = lenFrac;
31175
31190
  opts._thickFrac = thickFrac;
31176
- opts._xLeftFrac = xLeftFrac;
31177
- opts._yBottomFrac = yBottomFrac;
31191
+ opts._uFrac = uFrac;
31192
+ opts._vFrac = vFrac;
31178
31193
 
31179
31194
  // stash mocked axis for contour label formatting
31180
31195
  var ax = opts._axis = mockColorBarAxis(gd, opts, zrange);
31181
31196
 
31182
31197
  // position can't go in through supplyDefaults
31183
31198
  // because that restricts it to [0,1]
31184
- ax.position = opts.x + xpadFrac + thickFrac;
31199
+ ax.position = optsX + xpadFrac + thickFrac;
31185
31200
 
31186
31201
  if(['top', 'bottom'].indexOf(titleSide) !== -1) {
31187
31202
  ax.title.side = titleSide;
31188
- ax.titlex = opts.x + xpadFrac;
31189
- ax.titley = yBottomFrac + (title.side === 'top' ? lenFrac - ypadFrac : ypadFrac);
31203
+ ax.titlex = optsX + xpadFrac;
31204
+ ax.titley = vFrac + (title.side === 'top' ? lenFrac - ypadFrac : ypadFrac);
31190
31205
  }
31191
31206
 
31192
31207
  if(line.color && opts.tickmode === 'auto') {
@@ -31194,7 +31209,7 @@ function drawColorBar(g, opts, gd) {
31194
31209
  ax.tick0 = levelsIn.start;
31195
31210
  var dtick = levelsIn.size;
31196
31211
  // expand if too many contours, so we don't get too many ticks
31197
- var autoNtick = Lib.constrain((yBottomPx - yTopPx) / 50, 4, 15) + 1;
31212
+ var autoNtick = Lib.constrain(lenPx / 50, 4, 15) + 1;
31198
31213
  var dtFactor = (zrange[1] - zrange[0]) / ((opts.nticks || autoNtick) * dtick);
31199
31214
  if(dtFactor > 1) {
31200
31215
  var dtexp = Math.pow(10, Math.floor(Math.log(dtFactor) / Math.LN10));
@@ -31212,8 +31227,8 @@ function drawColorBar(g, opts, gd) {
31212
31227
  // set domain after init, because we may want to
31213
31228
  // allow it outside [0,1]
31214
31229
  ax.domain = [
31215
- yBottomFrac + ypadFrac,
31216
- yBottomFrac + lenFrac - ypadFrac
31230
+ vFrac + ypadFrac,
31231
+ vFrac + lenFrac - ypadFrac
31217
31232
  ];
31218
31233
 
31219
31234
  ax.setScale();
@@ -31254,15 +31269,15 @@ function drawColorBar(g, opts, gd) {
31254
31269
  // draw the title so we know how much room it needs
31255
31270
  // when we squish the axis. This one only applies to
31256
31271
  // top or bottom titles, not right side.
31257
- var x = gs.l + (opts.x + xpadFrac) * gs.w;
31272
+ var x = gs.l + (optsX + xpadFrac) * gs.w;
31258
31273
  var fontSize = ax.title.font.size;
31259
31274
  var y;
31260
31275
 
31261
31276
  if(titleSide === 'top') {
31262
- y = (1 - (yBottomFrac + lenFrac - ypadFrac)) * gs.h +
31277
+ y = (1 - (vFrac + lenFrac - ypadFrac)) * gs.h +
31263
31278
  gs.t + 3 + fontSize * 0.75;
31264
31279
  } else {
31265
- y = (1 - (yBottomFrac + ypadFrac)) * gs.h +
31280
+ y = (1 - (vFrac + ypadFrac)) * gs.h +
31266
31281
  gs.t - 3 - fontSize * 0.25;
31267
31282
  }
31268
31283
  drawTitle(ax._id + 'title', {
@@ -31301,7 +31316,7 @@ function drawColorBar(g, opts, gd) {
31301
31316
  // squish the axis top to make room for the title
31302
31317
  var titleGroup = g.select('.' + cn.cbtitle);
31303
31318
  var titleText = titleGroup.select('text');
31304
- var titleTrans = [-opts.outlinewidth / 2, opts.outlinewidth / 2];
31319
+ var titleTrans = [-outlinewidth / 2, outlinewidth / 2];
31305
31320
  var mathJaxNode = titleGroup
31306
31321
  .select('.h' + ax._id + 'title-math-group')
31307
31322
  .node();
@@ -31373,7 +31388,7 @@ function drawColorBar(g, opts, gd) {
31373
31388
  // Colorbar cannot currently support opacities so we
31374
31389
  // use an opaque fill even when alpha channels present
31375
31390
  var fillEl = d3.select(this).attr({
31376
- x: xLeft,
31391
+ x: uPx,
31377
31392
  width: Math.max(thickPx, 2),
31378
31393
  y: d3.min(z),
31379
31394
  height: Math.max(d3.max(z) - d3.min(z), 2),
@@ -31397,7 +31412,7 @@ function drawColorBar(g, opts, gd) {
31397
31412
  lines.exit().remove();
31398
31413
  lines.each(function(d) {
31399
31414
  d3.select(this)
31400
- .attr('d', 'M' + xLeft + ',' +
31415
+ .attr('d', 'M' + uPx + ',' +
31401
31416
  (Math.round(ax.c2p(d)) + (line.width / 2) % 1) + 'h' + thickPx)
31402
31417
  .call(Drawing.lineGroupStyle, line.width, lineColormap(d), line.dash);
31403
31418
  });
@@ -31405,8 +31420,8 @@ function drawColorBar(g, opts, gd) {
31405
31420
  // force full redraw of labels and ticks
31406
31421
  axLayer.selectAll('g.' + ax._id + 'tick,path').remove();
31407
31422
 
31408
- var shift = xLeft + thickPx +
31409
- (opts.outlinewidth || 0) / 2 - (opts.ticks === 'outside' ? 1 : 0);
31423
+ var shift = uPx + thickPx +
31424
+ (outlinewidth || 0) / 2 - (opts.ticks === 'outside' ? 1 : 0);
31410
31425
 
31411
31426
  var vals = Axes.calcTicks(ax);
31412
31427
  var tickSign = Axes.getTickSigns(ax)[2];
@@ -31431,9 +31446,9 @@ function drawColorBar(g, opts, gd) {
31431
31446
  // TODO: why are we redrawing multiple times now with this?
31432
31447
  // I guess autoMargin doesn't like being post-promise?
31433
31448
  function positionCB() {
31434
- var innerWidth = thickPx + opts.outlinewidth / 2;
31449
+ var innerThickness = thickPx + outlinewidth / 2;
31435
31450
  if(ax.ticklabelposition.indexOf('inside') === -1) {
31436
- innerWidth += Drawing.bBox(axLayer.node()).width;
31451
+ innerThickness += Drawing.bBox(axLayer.node()).width;
31437
31452
  }
31438
31453
 
31439
31454
  titleEl = titleCont.select('text');
@@ -31448,66 +31463,65 @@ function drawColorBar(g, opts, gd) {
31448
31463
  // (except for top/bottom mathjax, above)
31449
31464
  // but the weird gs.l is because the titleunshift
31450
31465
  // transform gets removed by Drawing.bBox
31451
- titleWidth = Drawing.bBox(titleCont.node()).right - xLeft - gs.l;
31466
+ titleWidth = Drawing.bBox(titleCont.node()).right - uPx - gs.l;
31452
31467
  }
31453
- innerWidth = Math.max(innerWidth, titleWidth);
31468
+ innerThickness = Math.max(innerThickness, titleWidth);
31454
31469
  }
31455
31470
 
31456
- var outerwidth = 2 * opts.xpad + innerWidth + opts.borderwidth + opts.outlinewidth / 2;
31457
- var outerheight = yBottomPx - yTopPx;
31471
+ var outerThickness = 2 * xpad + innerThickness + borderwidth + outlinewidth / 2;
31458
31472
 
31459
31473
  g.select('.' + cn.cbbg).attr({
31460
- x: xLeft - opts.xpad - (opts.borderwidth + opts.outlinewidth) / 2,
31461
- y: yTopPx - yExtraPx,
31462
- width: Math.max(outerwidth, 2),
31463
- height: Math.max(outerheight + 2 * yExtraPx, 2)
31474
+ x: uPx - xpad - (borderwidth + outlinewidth) / 2,
31475
+ y: vPx - lenPx - yExtraPx,
31476
+ width: Math.max(outerThickness, 2),
31477
+ height: Math.max(lenPx + 2 * yExtraPx, 2)
31464
31478
  })
31465
31479
  .call(Color.fill, opts.bgcolor)
31466
31480
  .call(Color.stroke, opts.bordercolor)
31467
- .style('stroke-width', opts.borderwidth);
31481
+ .style('stroke-width', borderwidth);
31468
31482
 
31469
31483
  g.selectAll('.' + cn.cboutline).attr({
31470
- x: xLeft,
31471
- y: yTopPx + opts.ypad + (titleSide === 'top' ? titleHeight : 0),
31484
+ x: uPx,
31485
+ y: vPx - lenPx + ypad + (titleSide === 'top' ? titleHeight : 0),
31472
31486
  width: Math.max(thickPx, 2),
31473
- height: Math.max(outerheight - 2 * opts.ypad - titleHeight, 2)
31487
+ height: Math.max(lenPx - 2 * ypad - titleHeight, 2)
31474
31488
  })
31475
31489
  .call(Color.stroke, opts.outlinecolor)
31476
31490
  .style({
31477
31491
  fill: 'none',
31478
- 'stroke-width': opts.outlinewidth
31492
+ 'stroke-width': outlinewidth
31479
31493
  });
31480
31494
 
31481
31495
  // fix positioning for xanchor!='left'
31482
- var xoffset = ({center: 0.5, right: 1}[opts.xanchor] || 0) * outerwidth;
31496
+ var xoffset = ({center: 0.5, right: 1}[xanchor] || 0) * outerThickness;
31483
31497
  g.attr('transform', strTranslate(gs.l - xoffset, gs.t));
31484
31498
 
31485
31499
  // auto margin adjustment
31486
31500
  var marginOpts = {};
31487
- var tFrac = FROM_TL[opts.yanchor];
31488
- var bFrac = FROM_BR[opts.yanchor];
31489
- if(opts.lenmode === 'pixels') {
31490
- marginOpts.y = opts.y;
31491
- marginOpts.t = outerheight * tFrac;
31492
- marginOpts.b = outerheight * bFrac;
31501
+ var tFrac = FROM_TL[yanchor];
31502
+ var bFrac = FROM_BR[yanchor];
31503
+ if(lenmode === 'pixels') {
31504
+ marginOpts.y = optsY;
31505
+ marginOpts.t = lenPx * tFrac;
31506
+ marginOpts.b = lenPx * bFrac;
31493
31507
  } else {
31494
31508
  marginOpts.t = marginOpts.b = 0;
31495
- marginOpts.yt = opts.y + opts.len * tFrac;
31496
- marginOpts.yb = opts.y - opts.len * bFrac;
31509
+ marginOpts.yt = optsY + len * tFrac;
31510
+ marginOpts.yb = optsY - len * bFrac;
31497
31511
  }
31498
31512
 
31499
- var lFrac = FROM_TL[opts.xanchor];
31500
- var rFrac = FROM_BR[opts.xanchor];
31501
- if(opts.thicknessmode === 'pixels') {
31502
- marginOpts.x = opts.x;
31503
- marginOpts.l = outerwidth * lFrac;
31504
- marginOpts.r = outerwidth * rFrac;
31513
+ var lFrac = FROM_TL[xanchor];
31514
+ var rFrac = FROM_BR[xanchor];
31515
+ if(thicknessmode === 'pixels') {
31516
+ marginOpts.x = optsX;
31517
+ marginOpts.l = outerThickness * lFrac;
31518
+ marginOpts.r = outerThickness * rFrac;
31505
31519
  } else {
31506
- var extraThickness = outerwidth - thickPx;
31520
+ var extraThickness = outerThickness - thickPx;
31507
31521
  marginOpts.l = extraThickness * lFrac;
31508
31522
  marginOpts.r = extraThickness * rFrac;
31509
- marginOpts.xl = opts.x - opts.thickness * lFrac;
31510
- marginOpts.xr = opts.x + opts.thickness * rFrac;
31523
+ marginOpts.xl = optsX - thickness * lFrac;
31524
+ marginOpts.xr = optsX + thickness * rFrac;
31511
31525
  }
31512
31526
 
31513
31527
  Plots.autoMargin(gd, opts._id, marginOpts);
@@ -31538,9 +31552,9 @@ function makeEditable(g, opts, gd) {
31538
31552
  moveFn: function(dx, dy) {
31539
31553
  g.attr('transform', t0 + strTranslate(dx, dy));
31540
31554
 
31541
- xf = dragElement.align(opts._xLeftFrac + (dx / gs.w), opts._thickFrac,
31555
+ xf = dragElement.align(opts._uFrac + (dx / gs.w), opts._thickFrac,
31542
31556
  0, 1, opts.xanchor);
31543
- yf = dragElement.align(opts._yBottomFrac - (dy / gs.h), opts._lenFrac,
31557
+ yf = dragElement.align(opts._vFrac - (dy / gs.h), opts._lenFrac,
31544
31558
  0, 1, opts.yanchor);
31545
31559
 
31546
31560
  var csr = dragElement.getCursor(xf, yf, opts.xanchor, opts.yanchor);
@@ -34119,7 +34133,7 @@ var TEXTOFFSETSIGN = {
34119
34133
  start: 1, end: -1, middle: 0, bottom: 1, top: -1
34120
34134
  };
34121
34135
 
34122
- function textPointPosition(s, textPosition, fontSize, markerRadius) {
34136
+ function textPointPosition(s, textPosition, fontSize, markerRadius, dontTouchParent) {
34123
34137
  var group = d3.select(s.node().parentNode);
34124
34138
 
34125
34139
  var v = textPosition.indexOf('top') !== -1 ?
@@ -34141,7 +34155,9 @@ function textPointPosition(s, textPosition, fontSize, markerRadius) {
34141
34155
 
34142
34156
  // fix the overall text group position
34143
34157
  s.attr('text-anchor', h);
34144
- group.attr('transform', strTranslate(dx, dy));
34158
+ if(!dontTouchParent) {
34159
+ group.attr('transform', strTranslate(dx, dy));
34160
+ }
34145
34161
  }
34146
34162
 
34147
34163
  function extracTextFontSize(d, trace) {
@@ -34211,7 +34227,8 @@ drawing.selectedTextStyle = function(s, trace) {
34211
34227
  var fontSize = extracTextFontSize(d, trace);
34212
34228
 
34213
34229
  Color.fill(tx, tc);
34214
- textPointPosition(tx, tp, fontSize, d.mrc2 || d.mrc);
34230
+ var dontTouchParent = Registry.traceIs(trace, 'bar-like');
34231
+ textPointPosition(tx, tp, fontSize, d.mrc2 || d.mrc, dontTouchParent);
34215
34232
  });
34216
34233
  };
34217
34234
 
@@ -36242,11 +36259,13 @@ var cartesianScatterPoints = {
36242
36259
  // The actual rendering is done by private function _hover.
36243
36260
  exports.hover = function hover(gd, evt, subplot, noHoverEvent) {
36244
36261
  gd = Lib.getGraphDiv(gd);
36245
-
36262
+ // The 'target' property changes when bubbling out of Shadow DOM.
36263
+ // Throttling can delay reading the target, so we save the current value.
36264
+ var eventTarget = evt.target;
36246
36265
  Lib.throttle(
36247
36266
  gd._fullLayout._uid + constants.HOVERID,
36248
36267
  constants.HOVERMINTIME,
36249
- function() { _hover(gd, evt, subplot, noHoverEvent); }
36268
+ function() { _hover(gd, evt, subplot, noHoverEvent, eventTarget); }
36250
36269
  );
36251
36270
  };
36252
36271
 
@@ -36411,7 +36430,7 @@ exports.loneHover = function loneHover(hoverItems, opts) {
36411
36430
  };
36412
36431
 
36413
36432
  // The actual implementation is here:
36414
- function _hover(gd, evt, subplot, noHoverEvent) {
36433
+ function _hover(gd, evt, subplot, noHoverEvent, eventTarget) {
36415
36434
  if(!subplot) subplot = 'xy';
36416
36435
 
36417
36436
  // if the user passed in an array of subplots,
@@ -36530,7 +36549,7 @@ function _hover(gd, evt, subplot, noHoverEvent) {
36530
36549
  // [x|y]px: the pixels (from top left) of the mouse location
36531
36550
  // on the currently selected plot area
36532
36551
  // add pointerX|Y property for drawing the spikes in spikesnap 'cursor' situation
36533
- var hasUserCalledHover = !evt.target;
36552
+ var hasUserCalledHover = !eventTarget;
36534
36553
  var xpx, ypx;
36535
36554
 
36536
36555
  if(hasUserCalledHover) {
@@ -36547,13 +36566,7 @@ function _hover(gd, evt, subplot, noHoverEvent) {
36547
36566
  return;
36548
36567
  }
36549
36568
 
36550
- // Discover event target, traversing open shadow roots.
36551
- var target = evt.composedPath && evt.composedPath()[0];
36552
- if(!target) {
36553
- // Fallback for browsers not supporting composedPath
36554
- target = evt.target;
36555
- }
36556
- var dbb = target.getBoundingClientRect();
36569
+ var dbb = eventTarget.getBoundingClientRect();
36557
36570
 
36558
36571
  xpx = evt.clientX - dbb.left;
36559
36572
  ypx = evt.clientY - dbb.top;
@@ -37001,15 +37014,15 @@ function _hover(gd, evt, subplot, noHoverEvent) {
37001
37014
  if(!helpers.isUnifiedHover(hovermode)) {
37002
37015
  hoverAvoidOverlaps(hoverLabels, rotateLabels ? 'xa' : 'ya', fullLayout);
37003
37016
  alignHoverText(hoverLabels, rotateLabels, fullLayout._invScaleX, fullLayout._invScaleY);
37004
- } // TODO: tagName hack is needed to appease geo.js's hack of using evt.target=true
37017
+ } // TODO: tagName hack is needed to appease geo.js's hack of using eventTarget=true
37005
37018
  // we should improve the "fx" API so other plots can use it without these hack.
37006
- if(evt.target && evt.target.tagName) {
37019
+ if(eventTarget && eventTarget.tagName) {
37007
37020
  var hasClickToShow = Registry.getComponentMethod('annotations', 'hasClickToShow')(gd, newhoverdata);
37008
- overrideCursor(d3.select(evt.target), hasClickToShow ? 'pointer' : '');
37021
+ overrideCursor(d3.select(eventTarget), hasClickToShow ? 'pointer' : '');
37009
37022
  }
37010
37023
 
37011
37024
  // don't emit events if called manually
37012
- if(!evt.target || noHoverEvent || !hoverChanged(gd, evt, oldhoverdata)) return;
37025
+ if(!eventTarget || noHoverEvent || !hoverChanged(gd, evt, oldhoverdata)) return;
37013
37026
 
37014
37027
  if(oldhoverdata) {
37015
37028
  gd.emit('plotly_unhover', {
@@ -60306,7 +60319,8 @@ function findUIPattern(key, patternSpecs) {
60306
60319
  var spec = patternSpecs[i];
60307
60320
  var match = key.match(spec.pattern);
60308
60321
  if(match) {
60309
- return {head: match[1], attr: spec.attr};
60322
+ var head = match[1] || '';
60323
+ return {head: head, tail: key.substr(head.length + 1), attr: spec.attr};
60310
60324
  }
60311
60325
  }
60312
60326
  }
@@ -60358,26 +60372,54 @@ function valsMatch(v1, v2) {
60358
60372
 
60359
60373
  function applyUIRevisions(data, layout, oldFullData, oldFullLayout) {
60360
60374
  var layoutPreGUI = oldFullLayout._preGUI;
60361
- var key, revAttr, oldRev, newRev, match, preGUIVal, newNP, newVal;
60375
+ var key, revAttr, oldRev, newRev, match, preGUIVal, newNP, newVal, head, tail;
60362
60376
  var bothInheritAutorange = [];
60377
+ var newAutorangeIn = {};
60363
60378
  var newRangeAccepted = {};
60364
60379
  for(key in layoutPreGUI) {
60365
60380
  match = findUIPattern(key, layoutUIControlPatterns);
60366
60381
  if(match) {
60367
- revAttr = match.attr || (match.head + '.uirevision');
60382
+ head = match.head;
60383
+ tail = match.tail;
60384
+ revAttr = match.attr || (head + '.uirevision');
60368
60385
  oldRev = nestedProperty(oldFullLayout, revAttr).get();
60369
60386
  newRev = oldRev && getNewRev(revAttr, layout);
60387
+
60370
60388
  if(newRev && (newRev === oldRev)) {
60371
60389
  preGUIVal = layoutPreGUI[key];
60372
60390
  if(preGUIVal === null) preGUIVal = undefined;
60373
60391
  newNP = nestedProperty(layout, key);
60374
60392
  newVal = newNP.get();
60393
+
60375
60394
  if(valsMatch(newVal, preGUIVal)) {
60376
- if(newVal === undefined && key.substr(key.length - 9) === 'autorange') {
60377
- bothInheritAutorange.push(key.substr(0, key.length - 10));
60395
+ if(newVal === undefined && tail === 'autorange') {
60396
+ bothInheritAutorange.push(head);
60378
60397
  }
60379
60398
  newNP.set(undefinedToNull(nestedProperty(oldFullLayout, key).get()));
60380
60399
  continue;
60400
+ } else if(tail === 'autorange' || tail.substr(0, 6) === 'range[') {
60401
+ // Special case for (auto)range since we push it back into the layout
60402
+ // so all null should be treated equivalently to autorange: true with any range
60403
+ var pre0 = layoutPreGUI[head + '.range[0]'];
60404
+ var pre1 = layoutPreGUI[head + '.range[1]'];
60405
+ var preAuto = layoutPreGUI[head + '.autorange'];
60406
+ if(preAuto || (preAuto === null && pre0 === null && pre1 === null)) {
60407
+ // Only read the input layout once and stash the result,
60408
+ // so we get it before we start modifying it
60409
+ if(!(head in newAutorangeIn)) {
60410
+ var newContainer = nestedProperty(layout, head).get();
60411
+ newAutorangeIn[head] = newContainer && (
60412
+ newContainer.autorange ||
60413
+ (newContainer.autorange !== false && (
60414
+ !newContainer.range || newContainer.range.length !== 2)
60415
+ )
60416
+ );
60417
+ }
60418
+ if(newAutorangeIn[head]) {
60419
+ newNP.set(undefinedToNull(nestedProperty(oldFullLayout, key).get()));
60420
+ continue;
60421
+ }
60422
+ }
60381
60423
  }
60382
60424
  }
60383
60425
  } else {
@@ -60388,12 +60430,12 @@ function applyUIRevisions(data, layout, oldFullData, oldFullLayout) {
60388
60430
  // so remove it from _preGUI for next time.
60389
60431
  delete layoutPreGUI[key];
60390
60432
 
60391
- if(key.substr(key.length - 8, 6) === 'range[') {
60392
- newRangeAccepted[key.substr(0, key.length - 9)] = 1;
60433
+ if(match && match.tail.substr(0, 6) === 'range[') {
60434
+ newRangeAccepted[match.head] = 1;
60393
60435
  }
60394
60436
  }
60395
60437
 
60396
- // Special logic for `autorange`, since it interacts with `range`:
60438
+ // More special logic for `autorange`, since it interacts with `range`:
60397
60439
  // If the new figure's matching `range` was kept, and `autorange`
60398
60440
  // wasn't supplied explicitly in either the original or the new figure,
60399
60441
  // we shouldn't alter that - but we may just have done that, so fix it.
@@ -85872,7 +85914,7 @@ function appendBarText(gd, plotinfo, bar, cd, i, x0, x1, y0, y1, opts, makeOnCom
85872
85914
  }
85873
85915
 
85874
85916
  transform.fontSize = font.size;
85875
- recordMinTextSize(trace.type, transform, fullLayout);
85917
+ recordMinTextSize(trace.type === 'histogram' ? 'bar' : trace.type, transform, fullLayout);
85876
85918
  calcBar.transform = transform;
85877
85919
 
85878
85920
  transition(textSelection, fullLayout, opts, makeOnCompleteCallback)
@@ -92379,6 +92421,8 @@ function isValidZ(z) {
92379
92421
  var barAttrs = _dereq_('../bar/attributes');
92380
92422
  var axisHoverFormat = _dereq_('../../plots/cartesian/axis_format_attributes').axisHoverFormat;
92381
92423
  var hovertemplateAttrs = _dereq_('../../plots/template_attributes').hovertemplateAttrs;
92424
+ var texttemplateAttrs = _dereq_('../../plots/template_attributes').texttemplateAttrs;
92425
+ var fontAttrs = _dereq_('../../plots/font_attributes');
92382
92426
  var makeBinAttrs = _dereq_('./bin_attributes');
92383
92427
  var constants = _dereq_('./constants');
92384
92428
  var extendFlat = _dereq_('../../lib/extend').extendFlat;
@@ -92473,6 +92517,41 @@ module.exports = {
92473
92517
  keys: constants.eventDataKeys
92474
92518
  }),
92475
92519
 
92520
+ texttemplate: texttemplateAttrs({
92521
+ arrayOk: false,
92522
+ editType: 'plot'
92523
+ }, {
92524
+ keys: ['label', 'value']
92525
+ }),
92526
+
92527
+ textposition: extendFlat({}, barAttrs.textposition, {
92528
+ arrayOk: false
92529
+ }),
92530
+
92531
+ textfont: fontAttrs({
92532
+ arrayOk: false,
92533
+ editType: 'plot',
92534
+ colorEditType: 'style',
92535
+ }),
92536
+
92537
+ outsidetextfont: fontAttrs({
92538
+ arrayOk: false,
92539
+ editType: 'plot',
92540
+ colorEditType: 'style',
92541
+ }),
92542
+
92543
+ insidetextfont: fontAttrs({
92544
+ arrayOk: false,
92545
+ editType: 'plot',
92546
+ colorEditType: 'style',
92547
+ }),
92548
+
92549
+ insidetextanchor: barAttrs.insidetextanchor,
92550
+
92551
+ textangle: barAttrs.textangle,
92552
+ cliponaxis: barAttrs.cliponaxis,
92553
+ constraintext: barAttrs.constraintext,
92554
+
92476
92555
  marker: barAttrs.marker,
92477
92556
 
92478
92557
  offsetgroup: barAttrs.offsetgroup,
@@ -92486,7 +92565,7 @@ module.exports = {
92486
92565
  }
92487
92566
  };
92488
92567
 
92489
- },{"../../lib/extend":281,"../../plots/cartesian/axis_format_attributes":337,"../../plots/template_attributes":373,"../bar/attributes":388,"./bin_attributes":456,"./constants":460}],455:[function(_dereq_,module,exports){
92568
+ },{"../../lib/extend":281,"../../plots/cartesian/axis_format_attributes":337,"../../plots/font_attributes":365,"../../plots/template_attributes":373,"../bar/attributes":388,"./bin_attributes":456,"./constants":460}],455:[function(_dereq_,module,exports){
92490
92569
  'use strict';
92491
92570
 
92492
92571
 
@@ -93609,6 +93688,7 @@ var Registry = _dereq_('../../registry');
93609
93688
  var Lib = _dereq_('../../lib');
93610
93689
  var Color = _dereq_('../../components/color');
93611
93690
 
93691
+ var handleText = _dereq_('../bar/defaults').handleText;
93612
93692
  var handleStyleDefaults = _dereq_('../bar/style_defaults');
93613
93693
  var attributes = _dereq_('./attributes');
93614
93694
 
@@ -93627,6 +93707,16 @@ module.exports = function supplyDefaults(traceIn, traceOut, defaultColor, layout
93627
93707
  }
93628
93708
 
93629
93709
  coerce('text');
93710
+ var textposition = coerce('textposition');
93711
+ handleText(traceIn, traceOut, layout, coerce, textposition, {
93712
+ moduleHasSelected: true,
93713
+ moduleHasUnselected: true,
93714
+ moduleHasConstrain: true,
93715
+ moduleHasCliponaxis: true,
93716
+ moduleHasTextangle: true,
93717
+ moduleHasInsideanchor: true
93718
+ });
93719
+
93630
93720
  coerce('hovertext');
93631
93721
  coerce('hovertemplate');
93632
93722
  coerce('xhoverformat');
@@ -93670,7 +93760,7 @@ module.exports = function supplyDefaults(traceIn, traceOut, defaultColor, layout
93670
93760
  errorBarsSupplyDefaults(traceIn, traceOut, lineColor || Color.defaultLine, {axis: 'x', inherit: 'y'});
93671
93761
  };
93672
93762
 
93673
- },{"../../components/color":157,"../../lib":287,"../../registry":378,"../bar/style_defaults":403,"./attributes":454}],463:[function(_dereq_,module,exports){
93763
+ },{"../../components/color":157,"../../lib":287,"../../registry":378,"../bar/defaults":392,"../bar/style_defaults":403,"./attributes":454}],463:[function(_dereq_,module,exports){
93674
93764
  'use strict';
93675
93765
 
93676
93766
  module.exports = function eventData(out, pt, trace, cd, pointNumber) {
@@ -102149,7 +102239,7 @@ function getSortFunc(opts, d2c) {
102149
102239
  'use strict';
102150
102240
 
102151
102241
  // package version injected by `npm run preprocess`
102152
- exports.version = '2.6.1';
102242
+ exports.version = '2.7.0';
102153
102243
 
102154
102244
  },{}]},{},[15])(15)
102155
102245
  });