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 (strict) v2.6.1
2
+ * plotly.js (strict) v2.7.0
3
3
  * Copyright 2012-2021, Plotly, Inc.
4
4
  * All rights reserved.
5
5
  * Licensed under the MIT license
@@ -81841,15 +81841,18 @@ var SIG_EXIF = str2arr('Exif\0\0');
81841
81841
  module.exports = function (data) {
81842
81842
  if (data.length < 2) return;
81843
81843
 
81844
- // first marker of the file MUST be 0xFFD8
81845
- if (data[0] !== 0xFF || data[1] !== 0xD8) return;
81844
+ // first marker of the file MUST be 0xFFD8,
81845
+ // following by either 0xFFE0, 0xFFE2 or 0xFFE3
81846
+ if (data[0] !== 0xFF || data[1] !== 0xD8 || data[2] !== 0xFF) return;
81846
81847
 
81847
81848
  var offset = 2;
81848
81849
 
81849
81850
  for (;;) {
81850
- if (data.length - offset < 2) return;
81851
- // not a JPEG marker
81852
- if (data[offset++] !== 0xFF) return;
81851
+ // skip until we see 0xFF, see https://github.com/nodeca/probe-image-size/issues/68
81852
+ for (;;) {
81853
+ if (data.length - offset < 2) return;
81854
+ if (data[offset++] === 0xFF) break;
81855
+ }
81853
81856
 
81854
81857
  var code = data[offset++];
81855
81858
  var length;
@@ -88403,8 +88406,7 @@ var parseUnit = _dereq_('parse-unit')
88403
88406
 
88404
88407
  module.exports = toPX
88405
88408
 
88406
- var PIXELS_PER_INCH = getSizeBrutal('in', document.body) // 96
88407
-
88409
+ var PIXELS_PER_INCH = 96
88408
88410
 
88409
88411
  function getPropertyInPX(element, prop) {
88410
88412
  var parts = parseUnit(getComputedStyle(element).getPropertyValue(prop))
@@ -88414,22 +88416,19 @@ function getPropertyInPX(element, prop) {
88414
88416
  //This brutal hack is needed
88415
88417
  function getSizeBrutal(unit, element) {
88416
88418
  var testDIV = document.createElement('div')
88417
- testDIV.style['height'] = '128' + unit
88419
+ testDIV.style['font-size'] = '128' + unit
88418
88420
  element.appendChild(testDIV)
88419
- var size = getPropertyInPX(testDIV, 'height') / 128
88421
+ var size = getPropertyInPX(testDIV, 'font-size') / 128
88420
88422
  element.removeChild(testDIV)
88421
88423
  return size
88422
88424
  }
88423
88425
 
88424
88426
  function toPX(str, element) {
88425
- if (!str) return null
88426
-
88427
88427
  element = element || document.body
88428
- str = (str + '' || 'px').trim().toLowerCase()
88428
+ str = (str || 'px').trim().toLowerCase()
88429
88429
  if(element === window || element === document) {
88430
- element = document.body
88430
+ element = document.body
88431
88431
  }
88432
-
88433
88432
  switch(str) {
88434
88433
  case '%': //Ambiguous, not sure if we should use width or height
88435
88434
  return element.clientHeight / 100.0
@@ -88458,20 +88457,9 @@ function toPX(str, element) {
88458
88457
  return PIXELS_PER_INCH / 72
88459
88458
  case 'pc':
88460
88459
  return PIXELS_PER_INCH / 6
88461
- case 'px':
88462
- return 1
88463
88460
  }
88464
-
88465
- // detect number of units
88466
- var parts = parseUnit(str)
88467
- if (!isNaN(parts[0]) && parts[1]) {
88468
- var px = toPX(parts[1], element)
88469
- return typeof px === 'number' ? parts[0] * px : null
88470
- }
88471
-
88472
- return null
88461
+ return 1
88473
88462
  }
88474
-
88475
88463
  },{"parse-unit":147}],197:[function(_dereq_,module,exports){
88476
88464
  // https://github.com/topojson/topojson-client v3.1.0 Copyright 2019 Mike Bostock
88477
88465
  (function (global, factory) {
@@ -97147,6 +97135,19 @@ function makeColorBarData(gd) {
97147
97135
  }
97148
97136
 
97149
97137
  function drawColorBar(g, opts, gd) {
97138
+ var len = opts.len;
97139
+ var lenmode = opts.lenmode;
97140
+ var thickness = opts.thickness;
97141
+ var thicknessmode = opts.thicknessmode;
97142
+ var outlinewidth = opts.outlinewidth;
97143
+ var borderwidth = opts.borderwidth;
97144
+ var xanchor = opts.xanchor;
97145
+ var yanchor = opts.yanchor;
97146
+ var xpad = opts.xpad;
97147
+ var ypad = opts.ypad;
97148
+ var optsX = opts.x;
97149
+ var optsY = opts.y;
97150
+
97150
97151
  var fullLayout = gd._fullLayout;
97151
97152
  var gs = fullLayout._size;
97152
97153
 
@@ -97176,42 +97177,41 @@ function drawColorBar(g, opts, gd) {
97176
97177
  // when the colorbar itself is pushing the margins.
97177
97178
  // but then the fractional size is calculated based on the
97178
97179
  // actual graph size, so that the axes will size correctly.
97179
- var thickPx = Math.round(opts.thickness * (opts.thicknessmode === 'fraction' ? gs.w : 1));
97180
+ var thickPx = Math.round(thickness * (thicknessmode === 'fraction' ? gs.w : 1));
97180
97181
  var thickFrac = thickPx / gs.w;
97181
- var lenPx = Math.round(opts.len * (opts.lenmode === 'fraction' ? gs.h : 1));
97182
+ var lenPx = Math.round(len * (lenmode === 'fraction' ? gs.h : 1));
97182
97183
  var lenFrac = lenPx / gs.h;
97183
- var xpadFrac = opts.xpad / gs.w;
97184
- var yExtraPx = (opts.borderwidth + opts.outlinewidth) / 2;
97185
- var ypadFrac = opts.ypad / gs.h;
97184
+ var xpadFrac = xpad / gs.w;
97185
+ var yExtraPx = (borderwidth + outlinewidth) / 2;
97186
+ var ypadFrac = ypad / gs.h;
97186
97187
 
97187
97188
  // x positioning: do it initially just for left anchor,
97188
97189
  // then fix at the end (since we don't know the width yet)
97189
- var xLeft = Math.round(opts.x * gs.w + opts.xpad);
97190
+ var uPx = Math.round(optsX * gs.w + xpad);
97190
97191
  // for dragging... this is getting a little muddled...
97191
- var xLeftFrac = opts.x - thickFrac * ({center: 0.5, right: 1}[opts.xanchor] || 0);
97192
+ var uFrac = optsX - thickFrac * ({center: 0.5, right: 1}[xanchor] || 0);
97192
97193
 
97193
97194
  // y positioning we can do correctly from the start
97194
- var yBottomFrac = opts.y + lenFrac * (({top: -0.5, bottom: 0.5}[opts.yanchor] || 0) - 0.5);
97195
- var yBottomPx = Math.round(gs.h * (1 - yBottomFrac));
97196
- var yTopPx = yBottomPx - lenPx;
97195
+ var vFrac = optsY + lenFrac * (({top: -0.5, bottom: 0.5}[yanchor] || 0) - 0.5);
97196
+ var vPx = Math.round(gs.h * (1 - vFrac));
97197
97197
 
97198
97198
  // stash a few things for makeEditable
97199
97199
  opts._lenFrac = lenFrac;
97200
97200
  opts._thickFrac = thickFrac;
97201
- opts._xLeftFrac = xLeftFrac;
97202
- opts._yBottomFrac = yBottomFrac;
97201
+ opts._uFrac = uFrac;
97202
+ opts._vFrac = vFrac;
97203
97203
 
97204
97204
  // stash mocked axis for contour label formatting
97205
97205
  var ax = opts._axis = mockColorBarAxis(gd, opts, zrange);
97206
97206
 
97207
97207
  // position can't go in through supplyDefaults
97208
97208
  // because that restricts it to [0,1]
97209
- ax.position = opts.x + xpadFrac + thickFrac;
97209
+ ax.position = optsX + xpadFrac + thickFrac;
97210
97210
 
97211
97211
  if(['top', 'bottom'].indexOf(titleSide) !== -1) {
97212
97212
  ax.title.side = titleSide;
97213
- ax.titlex = opts.x + xpadFrac;
97214
- ax.titley = yBottomFrac + (title.side === 'top' ? lenFrac - ypadFrac : ypadFrac);
97213
+ ax.titlex = optsX + xpadFrac;
97214
+ ax.titley = vFrac + (title.side === 'top' ? lenFrac - ypadFrac : ypadFrac);
97215
97215
  }
97216
97216
 
97217
97217
  if(line.color && opts.tickmode === 'auto') {
@@ -97219,7 +97219,7 @@ function drawColorBar(g, opts, gd) {
97219
97219
  ax.tick0 = levelsIn.start;
97220
97220
  var dtick = levelsIn.size;
97221
97221
  // expand if too many contours, so we don't get too many ticks
97222
- var autoNtick = Lib.constrain((yBottomPx - yTopPx) / 50, 4, 15) + 1;
97222
+ var autoNtick = Lib.constrain(lenPx / 50, 4, 15) + 1;
97223
97223
  var dtFactor = (zrange[1] - zrange[0]) / ((opts.nticks || autoNtick) * dtick);
97224
97224
  if(dtFactor > 1) {
97225
97225
  var dtexp = Math.pow(10, Math.floor(Math.log(dtFactor) / Math.LN10));
@@ -97237,8 +97237,8 @@ function drawColorBar(g, opts, gd) {
97237
97237
  // set domain after init, because we may want to
97238
97238
  // allow it outside [0,1]
97239
97239
  ax.domain = [
97240
- yBottomFrac + ypadFrac,
97241
- yBottomFrac + lenFrac - ypadFrac
97240
+ vFrac + ypadFrac,
97241
+ vFrac + lenFrac - ypadFrac
97242
97242
  ];
97243
97243
 
97244
97244
  ax.setScale();
@@ -97279,15 +97279,15 @@ function drawColorBar(g, opts, gd) {
97279
97279
  // draw the title so we know how much room it needs
97280
97280
  // when we squish the axis. This one only applies to
97281
97281
  // top or bottom titles, not right side.
97282
- var x = gs.l + (opts.x + xpadFrac) * gs.w;
97282
+ var x = gs.l + (optsX + xpadFrac) * gs.w;
97283
97283
  var fontSize = ax.title.font.size;
97284
97284
  var y;
97285
97285
 
97286
97286
  if(titleSide === 'top') {
97287
- y = (1 - (yBottomFrac + lenFrac - ypadFrac)) * gs.h +
97287
+ y = (1 - (vFrac + lenFrac - ypadFrac)) * gs.h +
97288
97288
  gs.t + 3 + fontSize * 0.75;
97289
97289
  } else {
97290
- y = (1 - (yBottomFrac + ypadFrac)) * gs.h +
97290
+ y = (1 - (vFrac + ypadFrac)) * gs.h +
97291
97291
  gs.t - 3 - fontSize * 0.25;
97292
97292
  }
97293
97293
  drawTitle(ax._id + 'title', {
@@ -97326,7 +97326,7 @@ function drawColorBar(g, opts, gd) {
97326
97326
  // squish the axis top to make room for the title
97327
97327
  var titleGroup = g.select('.' + cn.cbtitle);
97328
97328
  var titleText = titleGroup.select('text');
97329
- var titleTrans = [-opts.outlinewidth / 2, opts.outlinewidth / 2];
97329
+ var titleTrans = [-outlinewidth / 2, outlinewidth / 2];
97330
97330
  var mathJaxNode = titleGroup
97331
97331
  .select('.h' + ax._id + 'title-math-group')
97332
97332
  .node();
@@ -97398,7 +97398,7 @@ function drawColorBar(g, opts, gd) {
97398
97398
  // Colorbar cannot currently support opacities so we
97399
97399
  // use an opaque fill even when alpha channels present
97400
97400
  var fillEl = d3.select(this).attr({
97401
- x: xLeft,
97401
+ x: uPx,
97402
97402
  width: Math.max(thickPx, 2),
97403
97403
  y: d3.min(z),
97404
97404
  height: Math.max(d3.max(z) - d3.min(z), 2),
@@ -97422,7 +97422,7 @@ function drawColorBar(g, opts, gd) {
97422
97422
  lines.exit().remove();
97423
97423
  lines.each(function(d) {
97424
97424
  d3.select(this)
97425
- .attr('d', 'M' + xLeft + ',' +
97425
+ .attr('d', 'M' + uPx + ',' +
97426
97426
  (Math.round(ax.c2p(d)) + (line.width / 2) % 1) + 'h' + thickPx)
97427
97427
  .call(Drawing.lineGroupStyle, line.width, lineColormap(d), line.dash);
97428
97428
  });
@@ -97430,8 +97430,8 @@ function drawColorBar(g, opts, gd) {
97430
97430
  // force full redraw of labels and ticks
97431
97431
  axLayer.selectAll('g.' + ax._id + 'tick,path').remove();
97432
97432
 
97433
- var shift = xLeft + thickPx +
97434
- (opts.outlinewidth || 0) / 2 - (opts.ticks === 'outside' ? 1 : 0);
97433
+ var shift = uPx + thickPx +
97434
+ (outlinewidth || 0) / 2 - (opts.ticks === 'outside' ? 1 : 0);
97435
97435
 
97436
97436
  var vals = Axes.calcTicks(ax);
97437
97437
  var tickSign = Axes.getTickSigns(ax)[2];
@@ -97456,9 +97456,9 @@ function drawColorBar(g, opts, gd) {
97456
97456
  // TODO: why are we redrawing multiple times now with this?
97457
97457
  // I guess autoMargin doesn't like being post-promise?
97458
97458
  function positionCB() {
97459
- var innerWidth = thickPx + opts.outlinewidth / 2;
97459
+ var innerThickness = thickPx + outlinewidth / 2;
97460
97460
  if(ax.ticklabelposition.indexOf('inside') === -1) {
97461
- innerWidth += Drawing.bBox(axLayer.node()).width;
97461
+ innerThickness += Drawing.bBox(axLayer.node()).width;
97462
97462
  }
97463
97463
 
97464
97464
  titleEl = titleCont.select('text');
@@ -97473,66 +97473,65 @@ function drawColorBar(g, opts, gd) {
97473
97473
  // (except for top/bottom mathjax, above)
97474
97474
  // but the weird gs.l is because the titleunshift
97475
97475
  // transform gets removed by Drawing.bBox
97476
- titleWidth = Drawing.bBox(titleCont.node()).right - xLeft - gs.l;
97476
+ titleWidth = Drawing.bBox(titleCont.node()).right - uPx - gs.l;
97477
97477
  }
97478
- innerWidth = Math.max(innerWidth, titleWidth);
97478
+ innerThickness = Math.max(innerThickness, titleWidth);
97479
97479
  }
97480
97480
 
97481
- var outerwidth = 2 * opts.xpad + innerWidth + opts.borderwidth + opts.outlinewidth / 2;
97482
- var outerheight = yBottomPx - yTopPx;
97481
+ var outerThickness = 2 * xpad + innerThickness + borderwidth + outlinewidth / 2;
97483
97482
 
97484
97483
  g.select('.' + cn.cbbg).attr({
97485
- x: xLeft - opts.xpad - (opts.borderwidth + opts.outlinewidth) / 2,
97486
- y: yTopPx - yExtraPx,
97487
- width: Math.max(outerwidth, 2),
97488
- height: Math.max(outerheight + 2 * yExtraPx, 2)
97484
+ x: uPx - xpad - (borderwidth + outlinewidth) / 2,
97485
+ y: vPx - lenPx - yExtraPx,
97486
+ width: Math.max(outerThickness, 2),
97487
+ height: Math.max(lenPx + 2 * yExtraPx, 2)
97489
97488
  })
97490
97489
  .call(Color.fill, opts.bgcolor)
97491
97490
  .call(Color.stroke, opts.bordercolor)
97492
- .style('stroke-width', opts.borderwidth);
97491
+ .style('stroke-width', borderwidth);
97493
97492
 
97494
97493
  g.selectAll('.' + cn.cboutline).attr({
97495
- x: xLeft,
97496
- y: yTopPx + opts.ypad + (titleSide === 'top' ? titleHeight : 0),
97494
+ x: uPx,
97495
+ y: vPx - lenPx + ypad + (titleSide === 'top' ? titleHeight : 0),
97497
97496
  width: Math.max(thickPx, 2),
97498
- height: Math.max(outerheight - 2 * opts.ypad - titleHeight, 2)
97497
+ height: Math.max(lenPx - 2 * ypad - titleHeight, 2)
97499
97498
  })
97500
97499
  .call(Color.stroke, opts.outlinecolor)
97501
97500
  .style({
97502
97501
  fill: 'none',
97503
- 'stroke-width': opts.outlinewidth
97502
+ 'stroke-width': outlinewidth
97504
97503
  });
97505
97504
 
97506
97505
  // fix positioning for xanchor!='left'
97507
- var xoffset = ({center: 0.5, right: 1}[opts.xanchor] || 0) * outerwidth;
97506
+ var xoffset = ({center: 0.5, right: 1}[xanchor] || 0) * outerThickness;
97508
97507
  g.attr('transform', strTranslate(gs.l - xoffset, gs.t));
97509
97508
 
97510
97509
  // auto margin adjustment
97511
97510
  var marginOpts = {};
97512
- var tFrac = FROM_TL[opts.yanchor];
97513
- var bFrac = FROM_BR[opts.yanchor];
97514
- if(opts.lenmode === 'pixels') {
97515
- marginOpts.y = opts.y;
97516
- marginOpts.t = outerheight * tFrac;
97517
- marginOpts.b = outerheight * bFrac;
97511
+ var tFrac = FROM_TL[yanchor];
97512
+ var bFrac = FROM_BR[yanchor];
97513
+ if(lenmode === 'pixels') {
97514
+ marginOpts.y = optsY;
97515
+ marginOpts.t = lenPx * tFrac;
97516
+ marginOpts.b = lenPx * bFrac;
97518
97517
  } else {
97519
97518
  marginOpts.t = marginOpts.b = 0;
97520
- marginOpts.yt = opts.y + opts.len * tFrac;
97521
- marginOpts.yb = opts.y - opts.len * bFrac;
97519
+ marginOpts.yt = optsY + len * tFrac;
97520
+ marginOpts.yb = optsY - len * bFrac;
97522
97521
  }
97523
97522
 
97524
- var lFrac = FROM_TL[opts.xanchor];
97525
- var rFrac = FROM_BR[opts.xanchor];
97526
- if(opts.thicknessmode === 'pixels') {
97527
- marginOpts.x = opts.x;
97528
- marginOpts.l = outerwidth * lFrac;
97529
- marginOpts.r = outerwidth * rFrac;
97523
+ var lFrac = FROM_TL[xanchor];
97524
+ var rFrac = FROM_BR[xanchor];
97525
+ if(thicknessmode === 'pixels') {
97526
+ marginOpts.x = optsX;
97527
+ marginOpts.l = outerThickness * lFrac;
97528
+ marginOpts.r = outerThickness * rFrac;
97530
97529
  } else {
97531
- var extraThickness = outerwidth - thickPx;
97530
+ var extraThickness = outerThickness - thickPx;
97532
97531
  marginOpts.l = extraThickness * lFrac;
97533
97532
  marginOpts.r = extraThickness * rFrac;
97534
- marginOpts.xl = opts.x - opts.thickness * lFrac;
97535
- marginOpts.xr = opts.x + opts.thickness * rFrac;
97533
+ marginOpts.xl = optsX - thickness * lFrac;
97534
+ marginOpts.xr = optsX + thickness * rFrac;
97536
97535
  }
97537
97536
 
97538
97537
  Plots.autoMargin(gd, opts._id, marginOpts);
@@ -97563,9 +97562,9 @@ function makeEditable(g, opts, gd) {
97563
97562
  moveFn: function(dx, dy) {
97564
97563
  g.attr('transform', t0 + strTranslate(dx, dy));
97565
97564
 
97566
- xf = dragElement.align(opts._xLeftFrac + (dx / gs.w), opts._thickFrac,
97565
+ xf = dragElement.align(opts._uFrac + (dx / gs.w), opts._thickFrac,
97567
97566
  0, 1, opts.xanchor);
97568
- yf = dragElement.align(opts._yBottomFrac - (dy / gs.h), opts._lenFrac,
97567
+ yf = dragElement.align(opts._vFrac - (dy / gs.h), opts._lenFrac,
97569
97568
  0, 1, opts.yanchor);
97570
97569
 
97571
97570
  var csr = dragElement.getCursor(xf, yf, opts.xanchor, opts.yanchor);
@@ -100144,7 +100143,7 @@ var TEXTOFFSETSIGN = {
100144
100143
  start: 1, end: -1, middle: 0, bottom: 1, top: -1
100145
100144
  };
100146
100145
 
100147
- function textPointPosition(s, textPosition, fontSize, markerRadius) {
100146
+ function textPointPosition(s, textPosition, fontSize, markerRadius, dontTouchParent) {
100148
100147
  var group = d3.select(s.node().parentNode);
100149
100148
 
100150
100149
  var v = textPosition.indexOf('top') !== -1 ?
@@ -100166,7 +100165,9 @@ function textPointPosition(s, textPosition, fontSize, markerRadius) {
100166
100165
 
100167
100166
  // fix the overall text group position
100168
100167
  s.attr('text-anchor', h);
100169
- group.attr('transform', strTranslate(dx, dy));
100168
+ if(!dontTouchParent) {
100169
+ group.attr('transform', strTranslate(dx, dy));
100170
+ }
100170
100171
  }
100171
100172
 
100172
100173
  function extracTextFontSize(d, trace) {
@@ -100236,7 +100237,8 @@ drawing.selectedTextStyle = function(s, trace) {
100236
100237
  var fontSize = extracTextFontSize(d, trace);
100237
100238
 
100238
100239
  Color.fill(tx, tc);
100239
- textPointPosition(tx, tp, fontSize, d.mrc2 || d.mrc);
100240
+ var dontTouchParent = Registry.traceIs(trace, 'bar-like');
100241
+ textPointPosition(tx, tp, fontSize, d.mrc2 || d.mrc, dontTouchParent);
100240
100242
  });
100241
100243
  };
100242
100244
 
@@ -102267,11 +102269,13 @@ var cartesianScatterPoints = {
102267
102269
  // The actual rendering is done by private function _hover.
102268
102270
  exports.hover = function hover(gd, evt, subplot, noHoverEvent) {
102269
102271
  gd = Lib.getGraphDiv(gd);
102270
-
102272
+ // The 'target' property changes when bubbling out of Shadow DOM.
102273
+ // Throttling can delay reading the target, so we save the current value.
102274
+ var eventTarget = evt.target;
102271
102275
  Lib.throttle(
102272
102276
  gd._fullLayout._uid + constants.HOVERID,
102273
102277
  constants.HOVERMINTIME,
102274
- function() { _hover(gd, evt, subplot, noHoverEvent); }
102278
+ function() { _hover(gd, evt, subplot, noHoverEvent, eventTarget); }
102275
102279
  );
102276
102280
  };
102277
102281
 
@@ -102436,7 +102440,7 @@ exports.loneHover = function loneHover(hoverItems, opts) {
102436
102440
  };
102437
102441
 
102438
102442
  // The actual implementation is here:
102439
- function _hover(gd, evt, subplot, noHoverEvent) {
102443
+ function _hover(gd, evt, subplot, noHoverEvent, eventTarget) {
102440
102444
  if(!subplot) subplot = 'xy';
102441
102445
 
102442
102446
  // if the user passed in an array of subplots,
@@ -102555,7 +102559,7 @@ function _hover(gd, evt, subplot, noHoverEvent) {
102555
102559
  // [x|y]px: the pixels (from top left) of the mouse location
102556
102560
  // on the currently selected plot area
102557
102561
  // add pointerX|Y property for drawing the spikes in spikesnap 'cursor' situation
102558
- var hasUserCalledHover = !evt.target;
102562
+ var hasUserCalledHover = !eventTarget;
102559
102563
  var xpx, ypx;
102560
102564
 
102561
102565
  if(hasUserCalledHover) {
@@ -102572,13 +102576,7 @@ function _hover(gd, evt, subplot, noHoverEvent) {
102572
102576
  return;
102573
102577
  }
102574
102578
 
102575
- // Discover event target, traversing open shadow roots.
102576
- var target = evt.composedPath && evt.composedPath()[0];
102577
- if(!target) {
102578
- // Fallback for browsers not supporting composedPath
102579
- target = evt.target;
102580
- }
102581
- var dbb = target.getBoundingClientRect();
102579
+ var dbb = eventTarget.getBoundingClientRect();
102582
102580
 
102583
102581
  xpx = evt.clientX - dbb.left;
102584
102582
  ypx = evt.clientY - dbb.top;
@@ -103026,15 +103024,15 @@ function _hover(gd, evt, subplot, noHoverEvent) {
103026
103024
  if(!helpers.isUnifiedHover(hovermode)) {
103027
103025
  hoverAvoidOverlaps(hoverLabels, rotateLabels ? 'xa' : 'ya', fullLayout);
103028
103026
  alignHoverText(hoverLabels, rotateLabels, fullLayout._invScaleX, fullLayout._invScaleY);
103029
- } // TODO: tagName hack is needed to appease geo.js's hack of using evt.target=true
103027
+ } // TODO: tagName hack is needed to appease geo.js's hack of using eventTarget=true
103030
103028
  // we should improve the "fx" API so other plots can use it without these hack.
103031
- if(evt.target && evt.target.tagName) {
103029
+ if(eventTarget && eventTarget.tagName) {
103032
103030
  var hasClickToShow = Registry.getComponentMethod('annotations', 'hasClickToShow')(gd, newhoverdata);
103033
- overrideCursor(d3.select(evt.target), hasClickToShow ? 'pointer' : '');
103031
+ overrideCursor(d3.select(eventTarget), hasClickToShow ? 'pointer' : '');
103034
103032
  }
103035
103033
 
103036
103034
  // don't emit events if called manually
103037
- if(!evt.target || noHoverEvent || !hoverChanged(gd, evt, oldhoverdata)) return;
103035
+ if(!eventTarget || noHoverEvent || !hoverChanged(gd, evt, oldhoverdata)) return;
103038
103036
 
103039
103037
  if(oldhoverdata) {
103040
103038
  gd.emit('plotly_unhover', {
@@ -127070,7 +127068,8 @@ function findUIPattern(key, patternSpecs) {
127070
127068
  var spec = patternSpecs[i];
127071
127069
  var match = key.match(spec.pattern);
127072
127070
  if(match) {
127073
- return {head: match[1], attr: spec.attr};
127071
+ var head = match[1] || '';
127072
+ return {head: head, tail: key.substr(head.length + 1), attr: spec.attr};
127074
127073
  }
127075
127074
  }
127076
127075
  }
@@ -127122,26 +127121,54 @@ function valsMatch(v1, v2) {
127122
127121
 
127123
127122
  function applyUIRevisions(data, layout, oldFullData, oldFullLayout) {
127124
127123
  var layoutPreGUI = oldFullLayout._preGUI;
127125
- var key, revAttr, oldRev, newRev, match, preGUIVal, newNP, newVal;
127124
+ var key, revAttr, oldRev, newRev, match, preGUIVal, newNP, newVal, head, tail;
127126
127125
  var bothInheritAutorange = [];
127126
+ var newAutorangeIn = {};
127127
127127
  var newRangeAccepted = {};
127128
127128
  for(key in layoutPreGUI) {
127129
127129
  match = findUIPattern(key, layoutUIControlPatterns);
127130
127130
  if(match) {
127131
- revAttr = match.attr || (match.head + '.uirevision');
127131
+ head = match.head;
127132
+ tail = match.tail;
127133
+ revAttr = match.attr || (head + '.uirevision');
127132
127134
  oldRev = nestedProperty(oldFullLayout, revAttr).get();
127133
127135
  newRev = oldRev && getNewRev(revAttr, layout);
127136
+
127134
127137
  if(newRev && (newRev === oldRev)) {
127135
127138
  preGUIVal = layoutPreGUI[key];
127136
127139
  if(preGUIVal === null) preGUIVal = undefined;
127137
127140
  newNP = nestedProperty(layout, key);
127138
127141
  newVal = newNP.get();
127142
+
127139
127143
  if(valsMatch(newVal, preGUIVal)) {
127140
- if(newVal === undefined && key.substr(key.length - 9) === 'autorange') {
127141
- bothInheritAutorange.push(key.substr(0, key.length - 10));
127144
+ if(newVal === undefined && tail === 'autorange') {
127145
+ bothInheritAutorange.push(head);
127142
127146
  }
127143
127147
  newNP.set(undefinedToNull(nestedProperty(oldFullLayout, key).get()));
127144
127148
  continue;
127149
+ } else if(tail === 'autorange' || tail.substr(0, 6) === 'range[') {
127150
+ // Special case for (auto)range since we push it back into the layout
127151
+ // so all null should be treated equivalently to autorange: true with any range
127152
+ var pre0 = layoutPreGUI[head + '.range[0]'];
127153
+ var pre1 = layoutPreGUI[head + '.range[1]'];
127154
+ var preAuto = layoutPreGUI[head + '.autorange'];
127155
+ if(preAuto || (preAuto === null && pre0 === null && pre1 === null)) {
127156
+ // Only read the input layout once and stash the result,
127157
+ // so we get it before we start modifying it
127158
+ if(!(head in newAutorangeIn)) {
127159
+ var newContainer = nestedProperty(layout, head).get();
127160
+ newAutorangeIn[head] = newContainer && (
127161
+ newContainer.autorange ||
127162
+ (newContainer.autorange !== false && (
127163
+ !newContainer.range || newContainer.range.length !== 2)
127164
+ )
127165
+ );
127166
+ }
127167
+ if(newAutorangeIn[head]) {
127168
+ newNP.set(undefinedToNull(nestedProperty(oldFullLayout, key).get()));
127169
+ continue;
127170
+ }
127171
+ }
127145
127172
  }
127146
127173
  }
127147
127174
  } else {
@@ -127152,12 +127179,12 @@ function applyUIRevisions(data, layout, oldFullData, oldFullLayout) {
127152
127179
  // so remove it from _preGUI for next time.
127153
127180
  delete layoutPreGUI[key];
127154
127181
 
127155
- if(key.substr(key.length - 8, 6) === 'range[') {
127156
- newRangeAccepted[key.substr(0, key.length - 9)] = 1;
127182
+ if(match && match.tail.substr(0, 6) === 'range[') {
127183
+ newRangeAccepted[match.head] = 1;
127157
127184
  }
127158
127185
  }
127159
127186
 
127160
- // Special logic for `autorange`, since it interacts with `range`:
127187
+ // More special logic for `autorange`, since it interacts with `range`:
127161
127188
  // If the new figure's matching `range` was kept, and `autorange`
127162
127189
  // wasn't supplied explicitly in either the original or the new figure,
127163
127190
  // we shouldn't alter that - but we may just have done that, so fix it.
@@ -152007,11 +152034,14 @@ proto.project = function(v) {
152007
152034
  proto.getView = function() {
152008
152035
  var map = this.map;
152009
152036
  var mapCenter = map.getCenter();
152010
- var center = { lon: mapCenter.lng, lat: mapCenter.lat };
152037
+ var lon = mapCenter.lng;
152038
+ var lat = mapCenter.lat;
152039
+ var center = { lon: lon, lat: lat };
152011
152040
 
152012
152041
  var canvas = map.getCanvas();
152013
- var w = canvas.width;
152014
- var h = canvas.height;
152042
+ var w = parseInt(canvas.style.width);
152043
+ var h = parseInt(canvas.style.height);
152044
+
152015
152045
  return {
152016
152046
  center: center,
152017
152047
  zoom: map.getZoom(),
@@ -162819,7 +162849,7 @@ function appendBarText(gd, plotinfo, bar, cd, i, x0, x1, y0, y1, opts, makeOnCom
162819
162849
  }
162820
162850
 
162821
162851
  transform.fontSize = font.size;
162822
- recordMinTextSize(trace.type, transform, fullLayout);
162852
+ recordMinTextSize(trace.type === 'histogram' ? 'bar' : trace.type, transform, fullLayout);
162823
162853
  calcBar.transform = transform;
162824
162854
 
162825
162855
  transition(textSelection, fullLayout, opts, makeOnCompleteCallback)
@@ -177151,6 +177181,8 @@ module.exports = {
177151
177181
  var barAttrs = _dereq_('../bar/attributes');
177152
177182
  var axisHoverFormat = _dereq_('../../plots/cartesian/axis_format_attributes').axisHoverFormat;
177153
177183
  var hovertemplateAttrs = _dereq_('../../plots/template_attributes').hovertemplateAttrs;
177184
+ var texttemplateAttrs = _dereq_('../../plots/template_attributes').texttemplateAttrs;
177185
+ var fontAttrs = _dereq_('../../plots/font_attributes');
177154
177186
  var makeBinAttrs = _dereq_('./bin_attributes');
177155
177187
  var constants = _dereq_('./constants');
177156
177188
  var extendFlat = _dereq_('../../lib/extend').extendFlat;
@@ -177245,6 +177277,41 @@ module.exports = {
177245
177277
  keys: constants.eventDataKeys
177246
177278
  }),
177247
177279
 
177280
+ texttemplate: texttemplateAttrs({
177281
+ arrayOk: false,
177282
+ editType: 'plot'
177283
+ }, {
177284
+ keys: ['label', 'value']
177285
+ }),
177286
+
177287
+ textposition: extendFlat({}, barAttrs.textposition, {
177288
+ arrayOk: false
177289
+ }),
177290
+
177291
+ textfont: fontAttrs({
177292
+ arrayOk: false,
177293
+ editType: 'plot',
177294
+ colorEditType: 'style',
177295
+ }),
177296
+
177297
+ outsidetextfont: fontAttrs({
177298
+ arrayOk: false,
177299
+ editType: 'plot',
177300
+ colorEditType: 'style',
177301
+ }),
177302
+
177303
+ insidetextfont: fontAttrs({
177304
+ arrayOk: false,
177305
+ editType: 'plot',
177306
+ colorEditType: 'style',
177307
+ }),
177308
+
177309
+ insidetextanchor: barAttrs.insidetextanchor,
177310
+
177311
+ textangle: barAttrs.textangle,
177312
+ cliponaxis: barAttrs.cliponaxis,
177313
+ constraintext: barAttrs.constraintext,
177314
+
177248
177315
  marker: barAttrs.marker,
177249
177316
 
177250
177317
  offsetgroup: barAttrs.offsetgroup,
@@ -177258,7 +177325,7 @@ module.exports = {
177258
177325
  }
177259
177326
  };
177260
177327
 
177261
- },{"../../lib/extend":361,"../../plots/cartesian/axis_format_attributes":424,"../../plots/template_attributes":496,"../bar/attributes":511,"./bin_attributes":676,"./constants":680}],675:[function(_dereq_,module,exports){
177328
+ },{"../../lib/extend":361,"../../plots/cartesian/axis_format_attributes":424,"../../plots/font_attributes":452,"../../plots/template_attributes":496,"../bar/attributes":511,"./bin_attributes":676,"./constants":680}],675:[function(_dereq_,module,exports){
177262
177329
  'use strict';
177263
177330
 
177264
177331
 
@@ -178381,6 +178448,7 @@ var Registry = _dereq_('../../registry');
178381
178448
  var Lib = _dereq_('../../lib');
178382
178449
  var Color = _dereq_('../../components/color');
178383
178450
 
178451
+ var handleText = _dereq_('../bar/defaults').handleText;
178384
178452
  var handleStyleDefaults = _dereq_('../bar/style_defaults');
178385
178453
  var attributes = _dereq_('./attributes');
178386
178454
 
@@ -178399,6 +178467,16 @@ module.exports = function supplyDefaults(traceIn, traceOut, defaultColor, layout
178399
178467
  }
178400
178468
 
178401
178469
  coerce('text');
178470
+ var textposition = coerce('textposition');
178471
+ handleText(traceIn, traceOut, layout, coerce, textposition, {
178472
+ moduleHasSelected: true,
178473
+ moduleHasUnselected: true,
178474
+ moduleHasConstrain: true,
178475
+ moduleHasCliponaxis: true,
178476
+ moduleHasTextangle: true,
178477
+ moduleHasInsideanchor: true
178478
+ });
178479
+
178402
178480
  coerce('hovertext');
178403
178481
  coerce('hovertemplate');
178404
178482
  coerce('xhoverformat');
@@ -178442,7 +178520,7 @@ module.exports = function supplyDefaults(traceIn, traceOut, defaultColor, layout
178442
178520
  errorBarsSupplyDefaults(traceIn, traceOut, lineColor || Color.defaultLine, {axis: 'x', inherit: 'y'});
178443
178521
  };
178444
178522
 
178445
- },{"../../components/color":234,"../../lib":371,"../../registry":501,"../bar/style_defaults":526,"./attributes":674}],683:[function(_dereq_,module,exports){
178523
+ },{"../../components/color":234,"../../lib":371,"../../registry":501,"../bar/defaults":515,"../bar/style_defaults":526,"./attributes":674}],683:[function(_dereq_,module,exports){
178446
178524
  'use strict';
178447
178525
 
178448
178526
  module.exports = function eventData(out, pt, trace, cd, pointNumber) {
@@ -207711,7 +207789,7 @@ function getSortFunc(opts, d2c) {
207711
207789
  'use strict';
207712
207790
 
207713
207791
  // package version injected by `npm run preprocess`
207714
- exports.version = '2.6.1';
207792
+ exports.version = '2.7.0';
207715
207793
 
207716
207794
  },{}],933:[function(_dereq_,module,exports){
207717
207795
  (function (global){(function (){