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.
- package/CHANGELOG.md +36 -0
- package/README.md +3 -3
- package/dist/README.md +26 -26
- package/dist/plot-schema.json +117 -0
- package/dist/plotly-basic.js +129 -90
- package/dist/plotly-basic.min.js +2 -2
- package/dist/plotly-cartesian.js +187 -97
- package/dist/plotly-cartesian.min.js +2 -2
- package/dist/plotly-finance.js +179 -92
- package/dist/plotly-finance.min.js +2 -2
- package/dist/plotly-geo-assets.js +2 -2
- package/dist/plotly-geo.js +128 -89
- package/dist/plotly-geo.min.js +4 -4
- package/dist/plotly-gl2d.js +134 -110
- package/dist/plotly-gl2d.min.js +2 -2
- package/dist/plotly-gl3d.js +128 -89
- package/dist/plotly-gl3d.min.js +2 -2
- package/dist/plotly-mapbox.js +134 -92
- package/dist/plotly-mapbox.min.js +2 -2
- package/dist/plotly-strict.js +199 -121
- package/dist/plotly-strict.min.js +2 -2
- package/dist/plotly-with-meta.js +202 -121
- package/dist/plotly.js +199 -121
- package/dist/plotly.min.js +2 -2
- package/package.json +10 -9
- package/src/components/colorbar/draw.js +72 -61
- package/src/components/drawing/index.js +6 -3
- package/src/components/fx/hover.js +11 -15
- package/src/plot_api/plot_api.js +37 -8
- package/src/plots/mapbox/mapbox.js +6 -3
- package/src/traces/bar/plot.js +1 -1
- package/src/traces/histogram/attributes.js +40 -0
- package/src/traces/histogram/defaults.js +11 -0
- package/src/version.js +1 -1
package/dist/plotly-gl2d.js
CHANGED
|
@@ -1,5 +1,5 @@
|
|
|
1
1
|
/**
|
|
2
|
-
* plotly.js (gl2d) v2.
|
|
2
|
+
* plotly.js (gl2d) v2.7.0
|
|
3
3
|
* Copyright 2012-2021, Plotly, Inc.
|
|
4
4
|
* All rights reserved.
|
|
5
5
|
* Licensed under the MIT license
|
|
@@ -26790,8 +26790,7 @@ var parseUnit = _dereq_('parse-unit')
|
|
|
26790
26790
|
|
|
26791
26791
|
module.exports = toPX
|
|
26792
26792
|
|
|
26793
|
-
var PIXELS_PER_INCH =
|
|
26794
|
-
|
|
26793
|
+
var PIXELS_PER_INCH = 96
|
|
26795
26794
|
|
|
26796
26795
|
function getPropertyInPX(element, prop) {
|
|
26797
26796
|
var parts = parseUnit(getComputedStyle(element).getPropertyValue(prop))
|
|
@@ -26801,22 +26800,19 @@ function getPropertyInPX(element, prop) {
|
|
|
26801
26800
|
//This brutal hack is needed
|
|
26802
26801
|
function getSizeBrutal(unit, element) {
|
|
26803
26802
|
var testDIV = document.createElement('div')
|
|
26804
|
-
testDIV.style['
|
|
26803
|
+
testDIV.style['font-size'] = '128' + unit
|
|
26805
26804
|
element.appendChild(testDIV)
|
|
26806
|
-
var size = getPropertyInPX(testDIV, '
|
|
26805
|
+
var size = getPropertyInPX(testDIV, 'font-size') / 128
|
|
26807
26806
|
element.removeChild(testDIV)
|
|
26808
26807
|
return size
|
|
26809
26808
|
}
|
|
26810
26809
|
|
|
26811
26810
|
function toPX(str, element) {
|
|
26812
|
-
if (!str) return null
|
|
26813
|
-
|
|
26814
26811
|
element = element || document.body
|
|
26815
|
-
str = (str
|
|
26812
|
+
str = (str || 'px').trim().toLowerCase()
|
|
26816
26813
|
if(element === window || element === document) {
|
|
26817
|
-
element = document.body
|
|
26814
|
+
element = document.body
|
|
26818
26815
|
}
|
|
26819
|
-
|
|
26820
26816
|
switch(str) {
|
|
26821
26817
|
case '%': //Ambiguous, not sure if we should use width or height
|
|
26822
26818
|
return element.clientHeight / 100.0
|
|
@@ -26845,20 +26841,9 @@ function toPX(str, element) {
|
|
|
26845
26841
|
return PIXELS_PER_INCH / 72
|
|
26846
26842
|
case 'pc':
|
|
26847
26843
|
return PIXELS_PER_INCH / 6
|
|
26848
|
-
case 'px':
|
|
26849
|
-
return 1
|
|
26850
|
-
}
|
|
26851
|
-
|
|
26852
|
-
// detect number of units
|
|
26853
|
-
var parts = parseUnit(str)
|
|
26854
|
-
if (!isNaN(parts[0]) && parts[1]) {
|
|
26855
|
-
var px = toPX(parts[1], element)
|
|
26856
|
-
return typeof px === 'number' ? parts[0] * px : null
|
|
26857
26844
|
}
|
|
26858
|
-
|
|
26859
|
-
return null
|
|
26845
|
+
return 1
|
|
26860
26846
|
}
|
|
26861
|
-
|
|
26862
26847
|
},{"parse-unit":180}],207:[function(_dereq_,module,exports){
|
|
26863
26848
|
"use strict";
|
|
26864
26849
|
|
|
@@ -35440,6 +35425,19 @@ function makeColorBarData(gd) {
|
|
|
35440
35425
|
}
|
|
35441
35426
|
|
|
35442
35427
|
function drawColorBar(g, opts, gd) {
|
|
35428
|
+
var len = opts.len;
|
|
35429
|
+
var lenmode = opts.lenmode;
|
|
35430
|
+
var thickness = opts.thickness;
|
|
35431
|
+
var thicknessmode = opts.thicknessmode;
|
|
35432
|
+
var outlinewidth = opts.outlinewidth;
|
|
35433
|
+
var borderwidth = opts.borderwidth;
|
|
35434
|
+
var xanchor = opts.xanchor;
|
|
35435
|
+
var yanchor = opts.yanchor;
|
|
35436
|
+
var xpad = opts.xpad;
|
|
35437
|
+
var ypad = opts.ypad;
|
|
35438
|
+
var optsX = opts.x;
|
|
35439
|
+
var optsY = opts.y;
|
|
35440
|
+
|
|
35443
35441
|
var fullLayout = gd._fullLayout;
|
|
35444
35442
|
var gs = fullLayout._size;
|
|
35445
35443
|
|
|
@@ -35469,42 +35467,41 @@ function drawColorBar(g, opts, gd) {
|
|
|
35469
35467
|
// when the colorbar itself is pushing the margins.
|
|
35470
35468
|
// but then the fractional size is calculated based on the
|
|
35471
35469
|
// actual graph size, so that the axes will size correctly.
|
|
35472
|
-
var thickPx = Math.round(
|
|
35470
|
+
var thickPx = Math.round(thickness * (thicknessmode === 'fraction' ? gs.w : 1));
|
|
35473
35471
|
var thickFrac = thickPx / gs.w;
|
|
35474
|
-
var lenPx = Math.round(
|
|
35472
|
+
var lenPx = Math.round(len * (lenmode === 'fraction' ? gs.h : 1));
|
|
35475
35473
|
var lenFrac = lenPx / gs.h;
|
|
35476
|
-
var xpadFrac =
|
|
35477
|
-
var yExtraPx = (
|
|
35478
|
-
var ypadFrac =
|
|
35474
|
+
var xpadFrac = xpad / gs.w;
|
|
35475
|
+
var yExtraPx = (borderwidth + outlinewidth) / 2;
|
|
35476
|
+
var ypadFrac = ypad / gs.h;
|
|
35479
35477
|
|
|
35480
35478
|
// x positioning: do it initially just for left anchor,
|
|
35481
35479
|
// then fix at the end (since we don't know the width yet)
|
|
35482
|
-
var
|
|
35480
|
+
var uPx = Math.round(optsX * gs.w + xpad);
|
|
35483
35481
|
// for dragging... this is getting a little muddled...
|
|
35484
|
-
var
|
|
35482
|
+
var uFrac = optsX - thickFrac * ({center: 0.5, right: 1}[xanchor] || 0);
|
|
35485
35483
|
|
|
35486
35484
|
// y positioning we can do correctly from the start
|
|
35487
|
-
var
|
|
35488
|
-
var
|
|
35489
|
-
var yTopPx = yBottomPx - lenPx;
|
|
35485
|
+
var vFrac = optsY + lenFrac * (({top: -0.5, bottom: 0.5}[yanchor] || 0) - 0.5);
|
|
35486
|
+
var vPx = Math.round(gs.h * (1 - vFrac));
|
|
35490
35487
|
|
|
35491
35488
|
// stash a few things for makeEditable
|
|
35492
35489
|
opts._lenFrac = lenFrac;
|
|
35493
35490
|
opts._thickFrac = thickFrac;
|
|
35494
|
-
opts.
|
|
35495
|
-
opts.
|
|
35491
|
+
opts._uFrac = uFrac;
|
|
35492
|
+
opts._vFrac = vFrac;
|
|
35496
35493
|
|
|
35497
35494
|
// stash mocked axis for contour label formatting
|
|
35498
35495
|
var ax = opts._axis = mockColorBarAxis(gd, opts, zrange);
|
|
35499
35496
|
|
|
35500
35497
|
// position can't go in through supplyDefaults
|
|
35501
35498
|
// because that restricts it to [0,1]
|
|
35502
|
-
ax.position =
|
|
35499
|
+
ax.position = optsX + xpadFrac + thickFrac;
|
|
35503
35500
|
|
|
35504
35501
|
if(['top', 'bottom'].indexOf(titleSide) !== -1) {
|
|
35505
35502
|
ax.title.side = titleSide;
|
|
35506
|
-
ax.titlex =
|
|
35507
|
-
ax.titley =
|
|
35503
|
+
ax.titlex = optsX + xpadFrac;
|
|
35504
|
+
ax.titley = vFrac + (title.side === 'top' ? lenFrac - ypadFrac : ypadFrac);
|
|
35508
35505
|
}
|
|
35509
35506
|
|
|
35510
35507
|
if(line.color && opts.tickmode === 'auto') {
|
|
@@ -35512,7 +35509,7 @@ function drawColorBar(g, opts, gd) {
|
|
|
35512
35509
|
ax.tick0 = levelsIn.start;
|
|
35513
35510
|
var dtick = levelsIn.size;
|
|
35514
35511
|
// expand if too many contours, so we don't get too many ticks
|
|
35515
|
-
var autoNtick = Lib.constrain(
|
|
35512
|
+
var autoNtick = Lib.constrain(lenPx / 50, 4, 15) + 1;
|
|
35516
35513
|
var dtFactor = (zrange[1] - zrange[0]) / ((opts.nticks || autoNtick) * dtick);
|
|
35517
35514
|
if(dtFactor > 1) {
|
|
35518
35515
|
var dtexp = Math.pow(10, Math.floor(Math.log(dtFactor) / Math.LN10));
|
|
@@ -35530,8 +35527,8 @@ function drawColorBar(g, opts, gd) {
|
|
|
35530
35527
|
// set domain after init, because we may want to
|
|
35531
35528
|
// allow it outside [0,1]
|
|
35532
35529
|
ax.domain = [
|
|
35533
|
-
|
|
35534
|
-
|
|
35530
|
+
vFrac + ypadFrac,
|
|
35531
|
+
vFrac + lenFrac - ypadFrac
|
|
35535
35532
|
];
|
|
35536
35533
|
|
|
35537
35534
|
ax.setScale();
|
|
@@ -35572,15 +35569,15 @@ function drawColorBar(g, opts, gd) {
|
|
|
35572
35569
|
// draw the title so we know how much room it needs
|
|
35573
35570
|
// when we squish the axis. This one only applies to
|
|
35574
35571
|
// top or bottom titles, not right side.
|
|
35575
|
-
var x = gs.l + (
|
|
35572
|
+
var x = gs.l + (optsX + xpadFrac) * gs.w;
|
|
35576
35573
|
var fontSize = ax.title.font.size;
|
|
35577
35574
|
var y;
|
|
35578
35575
|
|
|
35579
35576
|
if(titleSide === 'top') {
|
|
35580
|
-
y = (1 - (
|
|
35577
|
+
y = (1 - (vFrac + lenFrac - ypadFrac)) * gs.h +
|
|
35581
35578
|
gs.t + 3 + fontSize * 0.75;
|
|
35582
35579
|
} else {
|
|
35583
|
-
y = (1 - (
|
|
35580
|
+
y = (1 - (vFrac + ypadFrac)) * gs.h +
|
|
35584
35581
|
gs.t - 3 - fontSize * 0.25;
|
|
35585
35582
|
}
|
|
35586
35583
|
drawTitle(ax._id + 'title', {
|
|
@@ -35619,7 +35616,7 @@ function drawColorBar(g, opts, gd) {
|
|
|
35619
35616
|
// squish the axis top to make room for the title
|
|
35620
35617
|
var titleGroup = g.select('.' + cn.cbtitle);
|
|
35621
35618
|
var titleText = titleGroup.select('text');
|
|
35622
|
-
var titleTrans = [-
|
|
35619
|
+
var titleTrans = [-outlinewidth / 2, outlinewidth / 2];
|
|
35623
35620
|
var mathJaxNode = titleGroup
|
|
35624
35621
|
.select('.h' + ax._id + 'title-math-group')
|
|
35625
35622
|
.node();
|
|
@@ -35691,7 +35688,7 @@ function drawColorBar(g, opts, gd) {
|
|
|
35691
35688
|
// Colorbar cannot currently support opacities so we
|
|
35692
35689
|
// use an opaque fill even when alpha channels present
|
|
35693
35690
|
var fillEl = d3.select(this).attr({
|
|
35694
|
-
x:
|
|
35691
|
+
x: uPx,
|
|
35695
35692
|
width: Math.max(thickPx, 2),
|
|
35696
35693
|
y: d3.min(z),
|
|
35697
35694
|
height: Math.max(d3.max(z) - d3.min(z), 2),
|
|
@@ -35715,7 +35712,7 @@ function drawColorBar(g, opts, gd) {
|
|
|
35715
35712
|
lines.exit().remove();
|
|
35716
35713
|
lines.each(function(d) {
|
|
35717
35714
|
d3.select(this)
|
|
35718
|
-
.attr('d', 'M' +
|
|
35715
|
+
.attr('d', 'M' + uPx + ',' +
|
|
35719
35716
|
(Math.round(ax.c2p(d)) + (line.width / 2) % 1) + 'h' + thickPx)
|
|
35720
35717
|
.call(Drawing.lineGroupStyle, line.width, lineColormap(d), line.dash);
|
|
35721
35718
|
});
|
|
@@ -35723,8 +35720,8 @@ function drawColorBar(g, opts, gd) {
|
|
|
35723
35720
|
// force full redraw of labels and ticks
|
|
35724
35721
|
axLayer.selectAll('g.' + ax._id + 'tick,path').remove();
|
|
35725
35722
|
|
|
35726
|
-
var shift =
|
|
35727
|
-
(
|
|
35723
|
+
var shift = uPx + thickPx +
|
|
35724
|
+
(outlinewidth || 0) / 2 - (opts.ticks === 'outside' ? 1 : 0);
|
|
35728
35725
|
|
|
35729
35726
|
var vals = Axes.calcTicks(ax);
|
|
35730
35727
|
var tickSign = Axes.getTickSigns(ax)[2];
|
|
@@ -35749,9 +35746,9 @@ function drawColorBar(g, opts, gd) {
|
|
|
35749
35746
|
// TODO: why are we redrawing multiple times now with this?
|
|
35750
35747
|
// I guess autoMargin doesn't like being post-promise?
|
|
35751
35748
|
function positionCB() {
|
|
35752
|
-
var
|
|
35749
|
+
var innerThickness = thickPx + outlinewidth / 2;
|
|
35753
35750
|
if(ax.ticklabelposition.indexOf('inside') === -1) {
|
|
35754
|
-
|
|
35751
|
+
innerThickness += Drawing.bBox(axLayer.node()).width;
|
|
35755
35752
|
}
|
|
35756
35753
|
|
|
35757
35754
|
titleEl = titleCont.select('text');
|
|
@@ -35766,66 +35763,65 @@ function drawColorBar(g, opts, gd) {
|
|
|
35766
35763
|
// (except for top/bottom mathjax, above)
|
|
35767
35764
|
// but the weird gs.l is because the titleunshift
|
|
35768
35765
|
// transform gets removed by Drawing.bBox
|
|
35769
|
-
titleWidth = Drawing.bBox(titleCont.node()).right -
|
|
35766
|
+
titleWidth = Drawing.bBox(titleCont.node()).right - uPx - gs.l;
|
|
35770
35767
|
}
|
|
35771
|
-
|
|
35768
|
+
innerThickness = Math.max(innerThickness, titleWidth);
|
|
35772
35769
|
}
|
|
35773
35770
|
|
|
35774
|
-
var
|
|
35775
|
-
var outerheight = yBottomPx - yTopPx;
|
|
35771
|
+
var outerThickness = 2 * xpad + innerThickness + borderwidth + outlinewidth / 2;
|
|
35776
35772
|
|
|
35777
35773
|
g.select('.' + cn.cbbg).attr({
|
|
35778
|
-
x:
|
|
35779
|
-
y:
|
|
35780
|
-
width: Math.max(
|
|
35781
|
-
height: Math.max(
|
|
35774
|
+
x: uPx - xpad - (borderwidth + outlinewidth) / 2,
|
|
35775
|
+
y: vPx - lenPx - yExtraPx,
|
|
35776
|
+
width: Math.max(outerThickness, 2),
|
|
35777
|
+
height: Math.max(lenPx + 2 * yExtraPx, 2)
|
|
35782
35778
|
})
|
|
35783
35779
|
.call(Color.fill, opts.bgcolor)
|
|
35784
35780
|
.call(Color.stroke, opts.bordercolor)
|
|
35785
|
-
.style('stroke-width',
|
|
35781
|
+
.style('stroke-width', borderwidth);
|
|
35786
35782
|
|
|
35787
35783
|
g.selectAll('.' + cn.cboutline).attr({
|
|
35788
|
-
x:
|
|
35789
|
-
y:
|
|
35784
|
+
x: uPx,
|
|
35785
|
+
y: vPx - lenPx + ypad + (titleSide === 'top' ? titleHeight : 0),
|
|
35790
35786
|
width: Math.max(thickPx, 2),
|
|
35791
|
-
height: Math.max(
|
|
35787
|
+
height: Math.max(lenPx - 2 * ypad - titleHeight, 2)
|
|
35792
35788
|
})
|
|
35793
35789
|
.call(Color.stroke, opts.outlinecolor)
|
|
35794
35790
|
.style({
|
|
35795
35791
|
fill: 'none',
|
|
35796
|
-
'stroke-width':
|
|
35792
|
+
'stroke-width': outlinewidth
|
|
35797
35793
|
});
|
|
35798
35794
|
|
|
35799
35795
|
// fix positioning for xanchor!='left'
|
|
35800
|
-
var xoffset = ({center: 0.5, right: 1}[
|
|
35796
|
+
var xoffset = ({center: 0.5, right: 1}[xanchor] || 0) * outerThickness;
|
|
35801
35797
|
g.attr('transform', strTranslate(gs.l - xoffset, gs.t));
|
|
35802
35798
|
|
|
35803
35799
|
// auto margin adjustment
|
|
35804
35800
|
var marginOpts = {};
|
|
35805
|
-
var tFrac = FROM_TL[
|
|
35806
|
-
var bFrac = FROM_BR[
|
|
35807
|
-
if(
|
|
35808
|
-
marginOpts.y =
|
|
35809
|
-
marginOpts.t =
|
|
35810
|
-
marginOpts.b =
|
|
35801
|
+
var tFrac = FROM_TL[yanchor];
|
|
35802
|
+
var bFrac = FROM_BR[yanchor];
|
|
35803
|
+
if(lenmode === 'pixels') {
|
|
35804
|
+
marginOpts.y = optsY;
|
|
35805
|
+
marginOpts.t = lenPx * tFrac;
|
|
35806
|
+
marginOpts.b = lenPx * bFrac;
|
|
35811
35807
|
} else {
|
|
35812
35808
|
marginOpts.t = marginOpts.b = 0;
|
|
35813
|
-
marginOpts.yt =
|
|
35814
|
-
marginOpts.yb =
|
|
35809
|
+
marginOpts.yt = optsY + len * tFrac;
|
|
35810
|
+
marginOpts.yb = optsY - len * bFrac;
|
|
35815
35811
|
}
|
|
35816
35812
|
|
|
35817
|
-
var lFrac = FROM_TL[
|
|
35818
|
-
var rFrac = FROM_BR[
|
|
35819
|
-
if(
|
|
35820
|
-
marginOpts.x =
|
|
35821
|
-
marginOpts.l =
|
|
35822
|
-
marginOpts.r =
|
|
35813
|
+
var lFrac = FROM_TL[xanchor];
|
|
35814
|
+
var rFrac = FROM_BR[xanchor];
|
|
35815
|
+
if(thicknessmode === 'pixels') {
|
|
35816
|
+
marginOpts.x = optsX;
|
|
35817
|
+
marginOpts.l = outerThickness * lFrac;
|
|
35818
|
+
marginOpts.r = outerThickness * rFrac;
|
|
35823
35819
|
} else {
|
|
35824
|
-
var extraThickness =
|
|
35820
|
+
var extraThickness = outerThickness - thickPx;
|
|
35825
35821
|
marginOpts.l = extraThickness * lFrac;
|
|
35826
35822
|
marginOpts.r = extraThickness * rFrac;
|
|
35827
|
-
marginOpts.xl =
|
|
35828
|
-
marginOpts.xr =
|
|
35823
|
+
marginOpts.xl = optsX - thickness * lFrac;
|
|
35824
|
+
marginOpts.xr = optsX + thickness * rFrac;
|
|
35829
35825
|
}
|
|
35830
35826
|
|
|
35831
35827
|
Plots.autoMargin(gd, opts._id, marginOpts);
|
|
@@ -35856,9 +35852,9 @@ function makeEditable(g, opts, gd) {
|
|
|
35856
35852
|
moveFn: function(dx, dy) {
|
|
35857
35853
|
g.attr('transform', t0 + strTranslate(dx, dy));
|
|
35858
35854
|
|
|
35859
|
-
xf = dragElement.align(opts.
|
|
35855
|
+
xf = dragElement.align(opts._uFrac + (dx / gs.w), opts._thickFrac,
|
|
35860
35856
|
0, 1, opts.xanchor);
|
|
35861
|
-
yf = dragElement.align(opts.
|
|
35857
|
+
yf = dragElement.align(opts._vFrac - (dy / gs.h), opts._lenFrac,
|
|
35862
35858
|
0, 1, opts.yanchor);
|
|
35863
35859
|
|
|
35864
35860
|
var csr = dragElement.getCursor(xf, yf, opts.xanchor, opts.yanchor);
|
|
@@ -38437,7 +38433,7 @@ var TEXTOFFSETSIGN = {
|
|
|
38437
38433
|
start: 1, end: -1, middle: 0, bottom: 1, top: -1
|
|
38438
38434
|
};
|
|
38439
38435
|
|
|
38440
|
-
function textPointPosition(s, textPosition, fontSize, markerRadius) {
|
|
38436
|
+
function textPointPosition(s, textPosition, fontSize, markerRadius, dontTouchParent) {
|
|
38441
38437
|
var group = d3.select(s.node().parentNode);
|
|
38442
38438
|
|
|
38443
38439
|
var v = textPosition.indexOf('top') !== -1 ?
|
|
@@ -38459,7 +38455,9 @@ function textPointPosition(s, textPosition, fontSize, markerRadius) {
|
|
|
38459
38455
|
|
|
38460
38456
|
// fix the overall text group position
|
|
38461
38457
|
s.attr('text-anchor', h);
|
|
38462
|
-
|
|
38458
|
+
if(!dontTouchParent) {
|
|
38459
|
+
group.attr('transform', strTranslate(dx, dy));
|
|
38460
|
+
}
|
|
38463
38461
|
}
|
|
38464
38462
|
|
|
38465
38463
|
function extracTextFontSize(d, trace) {
|
|
@@ -38529,7 +38527,8 @@ drawing.selectedTextStyle = function(s, trace) {
|
|
|
38529
38527
|
var fontSize = extracTextFontSize(d, trace);
|
|
38530
38528
|
|
|
38531
38529
|
Color.fill(tx, tc);
|
|
38532
|
-
|
|
38530
|
+
var dontTouchParent = Registry.traceIs(trace, 'bar-like');
|
|
38531
|
+
textPointPosition(tx, tp, fontSize, d.mrc2 || d.mrc, dontTouchParent);
|
|
38533
38532
|
});
|
|
38534
38533
|
};
|
|
38535
38534
|
|
|
@@ -40560,11 +40559,13 @@ var cartesianScatterPoints = {
|
|
|
40560
40559
|
// The actual rendering is done by private function _hover.
|
|
40561
40560
|
exports.hover = function hover(gd, evt, subplot, noHoverEvent) {
|
|
40562
40561
|
gd = Lib.getGraphDiv(gd);
|
|
40563
|
-
|
|
40562
|
+
// The 'target' property changes when bubbling out of Shadow DOM.
|
|
40563
|
+
// Throttling can delay reading the target, so we save the current value.
|
|
40564
|
+
var eventTarget = evt.target;
|
|
40564
40565
|
Lib.throttle(
|
|
40565
40566
|
gd._fullLayout._uid + constants.HOVERID,
|
|
40566
40567
|
constants.HOVERMINTIME,
|
|
40567
|
-
function() { _hover(gd, evt, subplot, noHoverEvent); }
|
|
40568
|
+
function() { _hover(gd, evt, subplot, noHoverEvent, eventTarget); }
|
|
40568
40569
|
);
|
|
40569
40570
|
};
|
|
40570
40571
|
|
|
@@ -40729,7 +40730,7 @@ exports.loneHover = function loneHover(hoverItems, opts) {
|
|
|
40729
40730
|
};
|
|
40730
40731
|
|
|
40731
40732
|
// The actual implementation is here:
|
|
40732
|
-
function _hover(gd, evt, subplot, noHoverEvent) {
|
|
40733
|
+
function _hover(gd, evt, subplot, noHoverEvent, eventTarget) {
|
|
40733
40734
|
if(!subplot) subplot = 'xy';
|
|
40734
40735
|
|
|
40735
40736
|
// if the user passed in an array of subplots,
|
|
@@ -40848,7 +40849,7 @@ function _hover(gd, evt, subplot, noHoverEvent) {
|
|
|
40848
40849
|
// [x|y]px: the pixels (from top left) of the mouse location
|
|
40849
40850
|
// on the currently selected plot area
|
|
40850
40851
|
// add pointerX|Y property for drawing the spikes in spikesnap 'cursor' situation
|
|
40851
|
-
var hasUserCalledHover = !
|
|
40852
|
+
var hasUserCalledHover = !eventTarget;
|
|
40852
40853
|
var xpx, ypx;
|
|
40853
40854
|
|
|
40854
40855
|
if(hasUserCalledHover) {
|
|
@@ -40865,13 +40866,7 @@ function _hover(gd, evt, subplot, noHoverEvent) {
|
|
|
40865
40866
|
return;
|
|
40866
40867
|
}
|
|
40867
40868
|
|
|
40868
|
-
|
|
40869
|
-
var target = evt.composedPath && evt.composedPath()[0];
|
|
40870
|
-
if(!target) {
|
|
40871
|
-
// Fallback for browsers not supporting composedPath
|
|
40872
|
-
target = evt.target;
|
|
40873
|
-
}
|
|
40874
|
-
var dbb = target.getBoundingClientRect();
|
|
40869
|
+
var dbb = eventTarget.getBoundingClientRect();
|
|
40875
40870
|
|
|
40876
40871
|
xpx = evt.clientX - dbb.left;
|
|
40877
40872
|
ypx = evt.clientY - dbb.top;
|
|
@@ -41319,15 +41314,15 @@ function _hover(gd, evt, subplot, noHoverEvent) {
|
|
|
41319
41314
|
if(!helpers.isUnifiedHover(hovermode)) {
|
|
41320
41315
|
hoverAvoidOverlaps(hoverLabels, rotateLabels ? 'xa' : 'ya', fullLayout);
|
|
41321
41316
|
alignHoverText(hoverLabels, rotateLabels, fullLayout._invScaleX, fullLayout._invScaleY);
|
|
41322
|
-
} // TODO: tagName hack is needed to appease geo.js's hack of using
|
|
41317
|
+
} // TODO: tagName hack is needed to appease geo.js's hack of using eventTarget=true
|
|
41323
41318
|
// we should improve the "fx" API so other plots can use it without these hack.
|
|
41324
|
-
if(
|
|
41319
|
+
if(eventTarget && eventTarget.tagName) {
|
|
41325
41320
|
var hasClickToShow = Registry.getComponentMethod('annotations', 'hasClickToShow')(gd, newhoverdata);
|
|
41326
|
-
overrideCursor(d3.select(
|
|
41321
|
+
overrideCursor(d3.select(eventTarget), hasClickToShow ? 'pointer' : '');
|
|
41327
41322
|
}
|
|
41328
41323
|
|
|
41329
41324
|
// don't emit events if called manually
|
|
41330
|
-
if(!
|
|
41325
|
+
if(!eventTarget || noHoverEvent || !hoverChanged(gd, evt, oldhoverdata)) return;
|
|
41331
41326
|
|
|
41332
41327
|
if(oldhoverdata) {
|
|
41333
41328
|
gd.emit('plotly_unhover', {
|
|
@@ -64878,7 +64873,8 @@ function findUIPattern(key, patternSpecs) {
|
|
|
64878
64873
|
var spec = patternSpecs[i];
|
|
64879
64874
|
var match = key.match(spec.pattern);
|
|
64880
64875
|
if(match) {
|
|
64881
|
-
|
|
64876
|
+
var head = match[1] || '';
|
|
64877
|
+
return {head: head, tail: key.substr(head.length + 1), attr: spec.attr};
|
|
64882
64878
|
}
|
|
64883
64879
|
}
|
|
64884
64880
|
}
|
|
@@ -64930,26 +64926,54 @@ function valsMatch(v1, v2) {
|
|
|
64930
64926
|
|
|
64931
64927
|
function applyUIRevisions(data, layout, oldFullData, oldFullLayout) {
|
|
64932
64928
|
var layoutPreGUI = oldFullLayout._preGUI;
|
|
64933
|
-
var key, revAttr, oldRev, newRev, match, preGUIVal, newNP, newVal;
|
|
64929
|
+
var key, revAttr, oldRev, newRev, match, preGUIVal, newNP, newVal, head, tail;
|
|
64934
64930
|
var bothInheritAutorange = [];
|
|
64931
|
+
var newAutorangeIn = {};
|
|
64935
64932
|
var newRangeAccepted = {};
|
|
64936
64933
|
for(key in layoutPreGUI) {
|
|
64937
64934
|
match = findUIPattern(key, layoutUIControlPatterns);
|
|
64938
64935
|
if(match) {
|
|
64939
|
-
|
|
64936
|
+
head = match.head;
|
|
64937
|
+
tail = match.tail;
|
|
64938
|
+
revAttr = match.attr || (head + '.uirevision');
|
|
64940
64939
|
oldRev = nestedProperty(oldFullLayout, revAttr).get();
|
|
64941
64940
|
newRev = oldRev && getNewRev(revAttr, layout);
|
|
64941
|
+
|
|
64942
64942
|
if(newRev && (newRev === oldRev)) {
|
|
64943
64943
|
preGUIVal = layoutPreGUI[key];
|
|
64944
64944
|
if(preGUIVal === null) preGUIVal = undefined;
|
|
64945
64945
|
newNP = nestedProperty(layout, key);
|
|
64946
64946
|
newVal = newNP.get();
|
|
64947
|
+
|
|
64947
64948
|
if(valsMatch(newVal, preGUIVal)) {
|
|
64948
|
-
if(newVal === undefined &&
|
|
64949
|
-
bothInheritAutorange.push(
|
|
64949
|
+
if(newVal === undefined && tail === 'autorange') {
|
|
64950
|
+
bothInheritAutorange.push(head);
|
|
64950
64951
|
}
|
|
64951
64952
|
newNP.set(undefinedToNull(nestedProperty(oldFullLayout, key).get()));
|
|
64952
64953
|
continue;
|
|
64954
|
+
} else if(tail === 'autorange' || tail.substr(0, 6) === 'range[') {
|
|
64955
|
+
// Special case for (auto)range since we push it back into the layout
|
|
64956
|
+
// so all null should be treated equivalently to autorange: true with any range
|
|
64957
|
+
var pre0 = layoutPreGUI[head + '.range[0]'];
|
|
64958
|
+
var pre1 = layoutPreGUI[head + '.range[1]'];
|
|
64959
|
+
var preAuto = layoutPreGUI[head + '.autorange'];
|
|
64960
|
+
if(preAuto || (preAuto === null && pre0 === null && pre1 === null)) {
|
|
64961
|
+
// Only read the input layout once and stash the result,
|
|
64962
|
+
// so we get it before we start modifying it
|
|
64963
|
+
if(!(head in newAutorangeIn)) {
|
|
64964
|
+
var newContainer = nestedProperty(layout, head).get();
|
|
64965
|
+
newAutorangeIn[head] = newContainer && (
|
|
64966
|
+
newContainer.autorange ||
|
|
64967
|
+
(newContainer.autorange !== false && (
|
|
64968
|
+
!newContainer.range || newContainer.range.length !== 2)
|
|
64969
|
+
)
|
|
64970
|
+
);
|
|
64971
|
+
}
|
|
64972
|
+
if(newAutorangeIn[head]) {
|
|
64973
|
+
newNP.set(undefinedToNull(nestedProperty(oldFullLayout, key).get()));
|
|
64974
|
+
continue;
|
|
64975
|
+
}
|
|
64976
|
+
}
|
|
64953
64977
|
}
|
|
64954
64978
|
}
|
|
64955
64979
|
} else {
|
|
@@ -64960,12 +64984,12 @@ function applyUIRevisions(data, layout, oldFullData, oldFullLayout) {
|
|
|
64960
64984
|
// so remove it from _preGUI for next time.
|
|
64961
64985
|
delete layoutPreGUI[key];
|
|
64962
64986
|
|
|
64963
|
-
if(
|
|
64964
|
-
newRangeAccepted[
|
|
64987
|
+
if(match && match.tail.substr(0, 6) === 'range[') {
|
|
64988
|
+
newRangeAccepted[match.head] = 1;
|
|
64965
64989
|
}
|
|
64966
64990
|
}
|
|
64967
64991
|
|
|
64968
|
-
//
|
|
64992
|
+
// More special logic for `autorange`, since it interacts with `range`:
|
|
64969
64993
|
// If the new figure's matching `range` was kept, and `autorange`
|
|
64970
64994
|
// wasn't supplied explicitly in either the original or the new figure,
|
|
64971
64995
|
// we shouldn't alter that - but we may just have done that, so fix it.
|
|
@@ -100568,7 +100592,7 @@ function getSortFunc(opts, d2c) {
|
|
|
100568
100592
|
'use strict';
|
|
100569
100593
|
|
|
100570
100594
|
// package version injected by `npm run preprocess`
|
|
100571
|
-
exports.version = '2.
|
|
100595
|
+
exports.version = '2.7.0';
|
|
100572
100596
|
|
|
100573
100597
|
},{}],588:[function(_dereq_,module,exports){
|
|
100574
100598
|
(function (global){(function (){
|