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.js
CHANGED
|
@@ -1,5 +1,5 @@
|
|
|
1
1
|
/**
|
|
2
|
-
* plotly.js v2.
|
|
2
|
+
* plotly.js v2.7.0
|
|
3
3
|
* Copyright 2012-2021, Plotly, Inc.
|
|
4
4
|
* All rights reserved.
|
|
5
5
|
* Licensed under the MIT license
|
|
@@ -87137,15 +87137,18 @@ var SIG_EXIF = str2arr('Exif\0\0');
|
|
|
87137
87137
|
module.exports = function (data) {
|
|
87138
87138
|
if (data.length < 2) return;
|
|
87139
87139
|
|
|
87140
|
-
// first marker of the file MUST be 0xFFD8
|
|
87141
|
-
|
|
87140
|
+
// first marker of the file MUST be 0xFFD8,
|
|
87141
|
+
// following by either 0xFFE0, 0xFFE2 or 0xFFE3
|
|
87142
|
+
if (data[0] !== 0xFF || data[1] !== 0xD8 || data[2] !== 0xFF) return;
|
|
87142
87143
|
|
|
87143
87144
|
var offset = 2;
|
|
87144
87145
|
|
|
87145
87146
|
for (;;) {
|
|
87146
|
-
|
|
87147
|
-
|
|
87148
|
-
|
|
87147
|
+
// skip until we see 0xFF, see https://github.com/nodeca/probe-image-size/issues/68
|
|
87148
|
+
for (;;) {
|
|
87149
|
+
if (data.length - offset < 2) return;
|
|
87150
|
+
if (data[offset++] === 0xFF) break;
|
|
87151
|
+
}
|
|
87149
87152
|
|
|
87150
87153
|
var code = data[offset++];
|
|
87151
87154
|
var length;
|
|
@@ -97194,8 +97197,7 @@ var parseUnit = _dereq_('parse-unit')
|
|
|
97194
97197
|
|
|
97195
97198
|
module.exports = toPX
|
|
97196
97199
|
|
|
97197
|
-
var PIXELS_PER_INCH =
|
|
97198
|
-
|
|
97200
|
+
var PIXELS_PER_INCH = 96
|
|
97199
97201
|
|
|
97200
97202
|
function getPropertyInPX(element, prop) {
|
|
97201
97203
|
var parts = parseUnit(getComputedStyle(element).getPropertyValue(prop))
|
|
@@ -97205,22 +97207,19 @@ function getPropertyInPX(element, prop) {
|
|
|
97205
97207
|
//This brutal hack is needed
|
|
97206
97208
|
function getSizeBrutal(unit, element) {
|
|
97207
97209
|
var testDIV = document.createElement('div')
|
|
97208
|
-
testDIV.style['
|
|
97210
|
+
testDIV.style['font-size'] = '128' + unit
|
|
97209
97211
|
element.appendChild(testDIV)
|
|
97210
|
-
var size = getPropertyInPX(testDIV, '
|
|
97212
|
+
var size = getPropertyInPX(testDIV, 'font-size') / 128
|
|
97211
97213
|
element.removeChild(testDIV)
|
|
97212
97214
|
return size
|
|
97213
97215
|
}
|
|
97214
97216
|
|
|
97215
97217
|
function toPX(str, element) {
|
|
97216
|
-
if (!str) return null
|
|
97217
|
-
|
|
97218
97218
|
element = element || document.body
|
|
97219
|
-
str = (str
|
|
97219
|
+
str = (str || 'px').trim().toLowerCase()
|
|
97220
97220
|
if(element === window || element === document) {
|
|
97221
|
-
element = document.body
|
|
97221
|
+
element = document.body
|
|
97222
97222
|
}
|
|
97223
|
-
|
|
97224
97223
|
switch(str) {
|
|
97225
97224
|
case '%': //Ambiguous, not sure if we should use width or height
|
|
97226
97225
|
return element.clientHeight / 100.0
|
|
@@ -97249,20 +97248,9 @@ function toPX(str, element) {
|
|
|
97249
97248
|
return PIXELS_PER_INCH / 72
|
|
97250
97249
|
case 'pc':
|
|
97251
97250
|
return PIXELS_PER_INCH / 6
|
|
97252
|
-
case 'px':
|
|
97253
|
-
return 1
|
|
97254
97251
|
}
|
|
97255
|
-
|
|
97256
|
-
// detect number of units
|
|
97257
|
-
var parts = parseUnit(str)
|
|
97258
|
-
if (!isNaN(parts[0]) && parts[1]) {
|
|
97259
|
-
var px = toPX(parts[1], element)
|
|
97260
|
-
return typeof px === 'number' ? parts[0] * px : null
|
|
97261
|
-
}
|
|
97262
|
-
|
|
97263
|
-
return null
|
|
97252
|
+
return 1
|
|
97264
97253
|
}
|
|
97265
|
-
|
|
97266
97254
|
},{"parse-unit":251}],315:[function(_dereq_,module,exports){
|
|
97267
97255
|
// https://github.com/topojson/topojson-client v3.1.0 Copyright 2019 Mike Bostock
|
|
97268
97256
|
(function (global, factory) {
|
|
@@ -106425,6 +106413,19 @@ function makeColorBarData(gd) {
|
|
|
106425
106413
|
}
|
|
106426
106414
|
|
|
106427
106415
|
function drawColorBar(g, opts, gd) {
|
|
106416
|
+
var len = opts.len;
|
|
106417
|
+
var lenmode = opts.lenmode;
|
|
106418
|
+
var thickness = opts.thickness;
|
|
106419
|
+
var thicknessmode = opts.thicknessmode;
|
|
106420
|
+
var outlinewidth = opts.outlinewidth;
|
|
106421
|
+
var borderwidth = opts.borderwidth;
|
|
106422
|
+
var xanchor = opts.xanchor;
|
|
106423
|
+
var yanchor = opts.yanchor;
|
|
106424
|
+
var xpad = opts.xpad;
|
|
106425
|
+
var ypad = opts.ypad;
|
|
106426
|
+
var optsX = opts.x;
|
|
106427
|
+
var optsY = opts.y;
|
|
106428
|
+
|
|
106428
106429
|
var fullLayout = gd._fullLayout;
|
|
106429
106430
|
var gs = fullLayout._size;
|
|
106430
106431
|
|
|
@@ -106454,42 +106455,41 @@ function drawColorBar(g, opts, gd) {
|
|
|
106454
106455
|
// when the colorbar itself is pushing the margins.
|
|
106455
106456
|
// but then the fractional size is calculated based on the
|
|
106456
106457
|
// actual graph size, so that the axes will size correctly.
|
|
106457
|
-
var thickPx = Math.round(
|
|
106458
|
+
var thickPx = Math.round(thickness * (thicknessmode === 'fraction' ? gs.w : 1));
|
|
106458
106459
|
var thickFrac = thickPx / gs.w;
|
|
106459
|
-
var lenPx = Math.round(
|
|
106460
|
+
var lenPx = Math.round(len * (lenmode === 'fraction' ? gs.h : 1));
|
|
106460
106461
|
var lenFrac = lenPx / gs.h;
|
|
106461
|
-
var xpadFrac =
|
|
106462
|
-
var yExtraPx = (
|
|
106463
|
-
var ypadFrac =
|
|
106462
|
+
var xpadFrac = xpad / gs.w;
|
|
106463
|
+
var yExtraPx = (borderwidth + outlinewidth) / 2;
|
|
106464
|
+
var ypadFrac = ypad / gs.h;
|
|
106464
106465
|
|
|
106465
106466
|
// x positioning: do it initially just for left anchor,
|
|
106466
106467
|
// then fix at the end (since we don't know the width yet)
|
|
106467
|
-
var
|
|
106468
|
+
var uPx = Math.round(optsX * gs.w + xpad);
|
|
106468
106469
|
// for dragging... this is getting a little muddled...
|
|
106469
|
-
var
|
|
106470
|
+
var uFrac = optsX - thickFrac * ({center: 0.5, right: 1}[xanchor] || 0);
|
|
106470
106471
|
|
|
106471
106472
|
// y positioning we can do correctly from the start
|
|
106472
|
-
var
|
|
106473
|
-
var
|
|
106474
|
-
var yTopPx = yBottomPx - lenPx;
|
|
106473
|
+
var vFrac = optsY + lenFrac * (({top: -0.5, bottom: 0.5}[yanchor] || 0) - 0.5);
|
|
106474
|
+
var vPx = Math.round(gs.h * (1 - vFrac));
|
|
106475
106475
|
|
|
106476
106476
|
// stash a few things for makeEditable
|
|
106477
106477
|
opts._lenFrac = lenFrac;
|
|
106478
106478
|
opts._thickFrac = thickFrac;
|
|
106479
|
-
opts.
|
|
106480
|
-
opts.
|
|
106479
|
+
opts._uFrac = uFrac;
|
|
106480
|
+
opts._vFrac = vFrac;
|
|
106481
106481
|
|
|
106482
106482
|
// stash mocked axis for contour label formatting
|
|
106483
106483
|
var ax = opts._axis = mockColorBarAxis(gd, opts, zrange);
|
|
106484
106484
|
|
|
106485
106485
|
// position can't go in through supplyDefaults
|
|
106486
106486
|
// because that restricts it to [0,1]
|
|
106487
|
-
ax.position =
|
|
106487
|
+
ax.position = optsX + xpadFrac + thickFrac;
|
|
106488
106488
|
|
|
106489
106489
|
if(['top', 'bottom'].indexOf(titleSide) !== -1) {
|
|
106490
106490
|
ax.title.side = titleSide;
|
|
106491
|
-
ax.titlex =
|
|
106492
|
-
ax.titley =
|
|
106491
|
+
ax.titlex = optsX + xpadFrac;
|
|
106492
|
+
ax.titley = vFrac + (title.side === 'top' ? lenFrac - ypadFrac : ypadFrac);
|
|
106493
106493
|
}
|
|
106494
106494
|
|
|
106495
106495
|
if(line.color && opts.tickmode === 'auto') {
|
|
@@ -106497,7 +106497,7 @@ function drawColorBar(g, opts, gd) {
|
|
|
106497
106497
|
ax.tick0 = levelsIn.start;
|
|
106498
106498
|
var dtick = levelsIn.size;
|
|
106499
106499
|
// expand if too many contours, so we don't get too many ticks
|
|
106500
|
-
var autoNtick = Lib.constrain(
|
|
106500
|
+
var autoNtick = Lib.constrain(lenPx / 50, 4, 15) + 1;
|
|
106501
106501
|
var dtFactor = (zrange[1] - zrange[0]) / ((opts.nticks || autoNtick) * dtick);
|
|
106502
106502
|
if(dtFactor > 1) {
|
|
106503
106503
|
var dtexp = Math.pow(10, Math.floor(Math.log(dtFactor) / Math.LN10));
|
|
@@ -106515,8 +106515,8 @@ function drawColorBar(g, opts, gd) {
|
|
|
106515
106515
|
// set domain after init, because we may want to
|
|
106516
106516
|
// allow it outside [0,1]
|
|
106517
106517
|
ax.domain = [
|
|
106518
|
-
|
|
106519
|
-
|
|
106518
|
+
vFrac + ypadFrac,
|
|
106519
|
+
vFrac + lenFrac - ypadFrac
|
|
106520
106520
|
];
|
|
106521
106521
|
|
|
106522
106522
|
ax.setScale();
|
|
@@ -106557,15 +106557,15 @@ function drawColorBar(g, opts, gd) {
|
|
|
106557
106557
|
// draw the title so we know how much room it needs
|
|
106558
106558
|
// when we squish the axis. This one only applies to
|
|
106559
106559
|
// top or bottom titles, not right side.
|
|
106560
|
-
var x = gs.l + (
|
|
106560
|
+
var x = gs.l + (optsX + xpadFrac) * gs.w;
|
|
106561
106561
|
var fontSize = ax.title.font.size;
|
|
106562
106562
|
var y;
|
|
106563
106563
|
|
|
106564
106564
|
if(titleSide === 'top') {
|
|
106565
|
-
y = (1 - (
|
|
106565
|
+
y = (1 - (vFrac + lenFrac - ypadFrac)) * gs.h +
|
|
106566
106566
|
gs.t + 3 + fontSize * 0.75;
|
|
106567
106567
|
} else {
|
|
106568
|
-
y = (1 - (
|
|
106568
|
+
y = (1 - (vFrac + ypadFrac)) * gs.h +
|
|
106569
106569
|
gs.t - 3 - fontSize * 0.25;
|
|
106570
106570
|
}
|
|
106571
106571
|
drawTitle(ax._id + 'title', {
|
|
@@ -106604,7 +106604,7 @@ function drawColorBar(g, opts, gd) {
|
|
|
106604
106604
|
// squish the axis top to make room for the title
|
|
106605
106605
|
var titleGroup = g.select('.' + cn.cbtitle);
|
|
106606
106606
|
var titleText = titleGroup.select('text');
|
|
106607
|
-
var titleTrans = [-
|
|
106607
|
+
var titleTrans = [-outlinewidth / 2, outlinewidth / 2];
|
|
106608
106608
|
var mathJaxNode = titleGroup
|
|
106609
106609
|
.select('.h' + ax._id + 'title-math-group')
|
|
106610
106610
|
.node();
|
|
@@ -106676,7 +106676,7 @@ function drawColorBar(g, opts, gd) {
|
|
|
106676
106676
|
// Colorbar cannot currently support opacities so we
|
|
106677
106677
|
// use an opaque fill even when alpha channels present
|
|
106678
106678
|
var fillEl = d3.select(this).attr({
|
|
106679
|
-
x:
|
|
106679
|
+
x: uPx,
|
|
106680
106680
|
width: Math.max(thickPx, 2),
|
|
106681
106681
|
y: d3.min(z),
|
|
106682
106682
|
height: Math.max(d3.max(z) - d3.min(z), 2),
|
|
@@ -106700,7 +106700,7 @@ function drawColorBar(g, opts, gd) {
|
|
|
106700
106700
|
lines.exit().remove();
|
|
106701
106701
|
lines.each(function(d) {
|
|
106702
106702
|
d3.select(this)
|
|
106703
|
-
.attr('d', 'M' +
|
|
106703
|
+
.attr('d', 'M' + uPx + ',' +
|
|
106704
106704
|
(Math.round(ax.c2p(d)) + (line.width / 2) % 1) + 'h' + thickPx)
|
|
106705
106705
|
.call(Drawing.lineGroupStyle, line.width, lineColormap(d), line.dash);
|
|
106706
106706
|
});
|
|
@@ -106708,8 +106708,8 @@ function drawColorBar(g, opts, gd) {
|
|
|
106708
106708
|
// force full redraw of labels and ticks
|
|
106709
106709
|
axLayer.selectAll('g.' + ax._id + 'tick,path').remove();
|
|
106710
106710
|
|
|
106711
|
-
var shift =
|
|
106712
|
-
(
|
|
106711
|
+
var shift = uPx + thickPx +
|
|
106712
|
+
(outlinewidth || 0) / 2 - (opts.ticks === 'outside' ? 1 : 0);
|
|
106713
106713
|
|
|
106714
106714
|
var vals = Axes.calcTicks(ax);
|
|
106715
106715
|
var tickSign = Axes.getTickSigns(ax)[2];
|
|
@@ -106734,9 +106734,9 @@ function drawColorBar(g, opts, gd) {
|
|
|
106734
106734
|
// TODO: why are we redrawing multiple times now with this?
|
|
106735
106735
|
// I guess autoMargin doesn't like being post-promise?
|
|
106736
106736
|
function positionCB() {
|
|
106737
|
-
var
|
|
106737
|
+
var innerThickness = thickPx + outlinewidth / 2;
|
|
106738
106738
|
if(ax.ticklabelposition.indexOf('inside') === -1) {
|
|
106739
|
-
|
|
106739
|
+
innerThickness += Drawing.bBox(axLayer.node()).width;
|
|
106740
106740
|
}
|
|
106741
106741
|
|
|
106742
106742
|
titleEl = titleCont.select('text');
|
|
@@ -106751,66 +106751,65 @@ function drawColorBar(g, opts, gd) {
|
|
|
106751
106751
|
// (except for top/bottom mathjax, above)
|
|
106752
106752
|
// but the weird gs.l is because the titleunshift
|
|
106753
106753
|
// transform gets removed by Drawing.bBox
|
|
106754
|
-
titleWidth = Drawing.bBox(titleCont.node()).right -
|
|
106754
|
+
titleWidth = Drawing.bBox(titleCont.node()).right - uPx - gs.l;
|
|
106755
106755
|
}
|
|
106756
|
-
|
|
106756
|
+
innerThickness = Math.max(innerThickness, titleWidth);
|
|
106757
106757
|
}
|
|
106758
106758
|
|
|
106759
|
-
var
|
|
106760
|
-
var outerheight = yBottomPx - yTopPx;
|
|
106759
|
+
var outerThickness = 2 * xpad + innerThickness + borderwidth + outlinewidth / 2;
|
|
106761
106760
|
|
|
106762
106761
|
g.select('.' + cn.cbbg).attr({
|
|
106763
|
-
x:
|
|
106764
|
-
y:
|
|
106765
|
-
width: Math.max(
|
|
106766
|
-
height: Math.max(
|
|
106762
|
+
x: uPx - xpad - (borderwidth + outlinewidth) / 2,
|
|
106763
|
+
y: vPx - lenPx - yExtraPx,
|
|
106764
|
+
width: Math.max(outerThickness, 2),
|
|
106765
|
+
height: Math.max(lenPx + 2 * yExtraPx, 2)
|
|
106767
106766
|
})
|
|
106768
106767
|
.call(Color.fill, opts.bgcolor)
|
|
106769
106768
|
.call(Color.stroke, opts.bordercolor)
|
|
106770
|
-
.style('stroke-width',
|
|
106769
|
+
.style('stroke-width', borderwidth);
|
|
106771
106770
|
|
|
106772
106771
|
g.selectAll('.' + cn.cboutline).attr({
|
|
106773
|
-
x:
|
|
106774
|
-
y:
|
|
106772
|
+
x: uPx,
|
|
106773
|
+
y: vPx - lenPx + ypad + (titleSide === 'top' ? titleHeight : 0),
|
|
106775
106774
|
width: Math.max(thickPx, 2),
|
|
106776
|
-
height: Math.max(
|
|
106775
|
+
height: Math.max(lenPx - 2 * ypad - titleHeight, 2)
|
|
106777
106776
|
})
|
|
106778
106777
|
.call(Color.stroke, opts.outlinecolor)
|
|
106779
106778
|
.style({
|
|
106780
106779
|
fill: 'none',
|
|
106781
|
-
'stroke-width':
|
|
106780
|
+
'stroke-width': outlinewidth
|
|
106782
106781
|
});
|
|
106783
106782
|
|
|
106784
106783
|
// fix positioning for xanchor!='left'
|
|
106785
|
-
var xoffset = ({center: 0.5, right: 1}[
|
|
106784
|
+
var xoffset = ({center: 0.5, right: 1}[xanchor] || 0) * outerThickness;
|
|
106786
106785
|
g.attr('transform', strTranslate(gs.l - xoffset, gs.t));
|
|
106787
106786
|
|
|
106788
106787
|
// auto margin adjustment
|
|
106789
106788
|
var marginOpts = {};
|
|
106790
|
-
var tFrac = FROM_TL[
|
|
106791
|
-
var bFrac = FROM_BR[
|
|
106792
|
-
if(
|
|
106793
|
-
marginOpts.y =
|
|
106794
|
-
marginOpts.t =
|
|
106795
|
-
marginOpts.b =
|
|
106789
|
+
var tFrac = FROM_TL[yanchor];
|
|
106790
|
+
var bFrac = FROM_BR[yanchor];
|
|
106791
|
+
if(lenmode === 'pixels') {
|
|
106792
|
+
marginOpts.y = optsY;
|
|
106793
|
+
marginOpts.t = lenPx * tFrac;
|
|
106794
|
+
marginOpts.b = lenPx * bFrac;
|
|
106796
106795
|
} else {
|
|
106797
106796
|
marginOpts.t = marginOpts.b = 0;
|
|
106798
|
-
marginOpts.yt =
|
|
106799
|
-
marginOpts.yb =
|
|
106797
|
+
marginOpts.yt = optsY + len * tFrac;
|
|
106798
|
+
marginOpts.yb = optsY - len * bFrac;
|
|
106800
106799
|
}
|
|
106801
106800
|
|
|
106802
|
-
var lFrac = FROM_TL[
|
|
106803
|
-
var rFrac = FROM_BR[
|
|
106804
|
-
if(
|
|
106805
|
-
marginOpts.x =
|
|
106806
|
-
marginOpts.l =
|
|
106807
|
-
marginOpts.r =
|
|
106801
|
+
var lFrac = FROM_TL[xanchor];
|
|
106802
|
+
var rFrac = FROM_BR[xanchor];
|
|
106803
|
+
if(thicknessmode === 'pixels') {
|
|
106804
|
+
marginOpts.x = optsX;
|
|
106805
|
+
marginOpts.l = outerThickness * lFrac;
|
|
106806
|
+
marginOpts.r = outerThickness * rFrac;
|
|
106808
106807
|
} else {
|
|
106809
|
-
var extraThickness =
|
|
106808
|
+
var extraThickness = outerThickness - thickPx;
|
|
106810
106809
|
marginOpts.l = extraThickness * lFrac;
|
|
106811
106810
|
marginOpts.r = extraThickness * rFrac;
|
|
106812
|
-
marginOpts.xl =
|
|
106813
|
-
marginOpts.xr =
|
|
106811
|
+
marginOpts.xl = optsX - thickness * lFrac;
|
|
106812
|
+
marginOpts.xr = optsX + thickness * rFrac;
|
|
106814
106813
|
}
|
|
106815
106814
|
|
|
106816
106815
|
Plots.autoMargin(gd, opts._id, marginOpts);
|
|
@@ -106841,9 +106840,9 @@ function makeEditable(g, opts, gd) {
|
|
|
106841
106840
|
moveFn: function(dx, dy) {
|
|
106842
106841
|
g.attr('transform', t0 + strTranslate(dx, dy));
|
|
106843
106842
|
|
|
106844
|
-
xf = dragElement.align(opts.
|
|
106843
|
+
xf = dragElement.align(opts._uFrac + (dx / gs.w), opts._thickFrac,
|
|
106845
106844
|
0, 1, opts.xanchor);
|
|
106846
|
-
yf = dragElement.align(opts.
|
|
106845
|
+
yf = dragElement.align(opts._vFrac - (dy / gs.h), opts._lenFrac,
|
|
106847
106846
|
0, 1, opts.yanchor);
|
|
106848
106847
|
|
|
106849
106848
|
var csr = dragElement.getCursor(xf, yf, opts.xanchor, opts.yanchor);
|
|
@@ -109422,7 +109421,7 @@ var TEXTOFFSETSIGN = {
|
|
|
109422
109421
|
start: 1, end: -1, middle: 0, bottom: 1, top: -1
|
|
109423
109422
|
};
|
|
109424
109423
|
|
|
109425
|
-
function textPointPosition(s, textPosition, fontSize, markerRadius) {
|
|
109424
|
+
function textPointPosition(s, textPosition, fontSize, markerRadius, dontTouchParent) {
|
|
109426
109425
|
var group = d3.select(s.node().parentNode);
|
|
109427
109426
|
|
|
109428
109427
|
var v = textPosition.indexOf('top') !== -1 ?
|
|
@@ -109444,7 +109443,9 @@ function textPointPosition(s, textPosition, fontSize, markerRadius) {
|
|
|
109444
109443
|
|
|
109445
109444
|
// fix the overall text group position
|
|
109446
109445
|
s.attr('text-anchor', h);
|
|
109447
|
-
|
|
109446
|
+
if(!dontTouchParent) {
|
|
109447
|
+
group.attr('transform', strTranslate(dx, dy));
|
|
109448
|
+
}
|
|
109448
109449
|
}
|
|
109449
109450
|
|
|
109450
109451
|
function extracTextFontSize(d, trace) {
|
|
@@ -109514,7 +109515,8 @@ drawing.selectedTextStyle = function(s, trace) {
|
|
|
109514
109515
|
var fontSize = extracTextFontSize(d, trace);
|
|
109515
109516
|
|
|
109516
109517
|
Color.fill(tx, tc);
|
|
109517
|
-
|
|
109518
|
+
var dontTouchParent = Registry.traceIs(trace, 'bar-like');
|
|
109519
|
+
textPointPosition(tx, tp, fontSize, d.mrc2 || d.mrc, dontTouchParent);
|
|
109518
109520
|
});
|
|
109519
109521
|
};
|
|
109520
109522
|
|
|
@@ -111545,11 +111547,13 @@ var cartesianScatterPoints = {
|
|
|
111545
111547
|
// The actual rendering is done by private function _hover.
|
|
111546
111548
|
exports.hover = function hover(gd, evt, subplot, noHoverEvent) {
|
|
111547
111549
|
gd = Lib.getGraphDiv(gd);
|
|
111548
|
-
|
|
111550
|
+
// The 'target' property changes when bubbling out of Shadow DOM.
|
|
111551
|
+
// Throttling can delay reading the target, so we save the current value.
|
|
111552
|
+
var eventTarget = evt.target;
|
|
111549
111553
|
Lib.throttle(
|
|
111550
111554
|
gd._fullLayout._uid + constants.HOVERID,
|
|
111551
111555
|
constants.HOVERMINTIME,
|
|
111552
|
-
function() { _hover(gd, evt, subplot, noHoverEvent); }
|
|
111556
|
+
function() { _hover(gd, evt, subplot, noHoverEvent, eventTarget); }
|
|
111553
111557
|
);
|
|
111554
111558
|
};
|
|
111555
111559
|
|
|
@@ -111714,7 +111718,7 @@ exports.loneHover = function loneHover(hoverItems, opts) {
|
|
|
111714
111718
|
};
|
|
111715
111719
|
|
|
111716
111720
|
// The actual implementation is here:
|
|
111717
|
-
function _hover(gd, evt, subplot, noHoverEvent) {
|
|
111721
|
+
function _hover(gd, evt, subplot, noHoverEvent, eventTarget) {
|
|
111718
111722
|
if(!subplot) subplot = 'xy';
|
|
111719
111723
|
|
|
111720
111724
|
// if the user passed in an array of subplots,
|
|
@@ -111833,7 +111837,7 @@ function _hover(gd, evt, subplot, noHoverEvent) {
|
|
|
111833
111837
|
// [x|y]px: the pixels (from top left) of the mouse location
|
|
111834
111838
|
// on the currently selected plot area
|
|
111835
111839
|
// add pointerX|Y property for drawing the spikes in spikesnap 'cursor' situation
|
|
111836
|
-
var hasUserCalledHover = !
|
|
111840
|
+
var hasUserCalledHover = !eventTarget;
|
|
111837
111841
|
var xpx, ypx;
|
|
111838
111842
|
|
|
111839
111843
|
if(hasUserCalledHover) {
|
|
@@ -111850,13 +111854,7 @@ function _hover(gd, evt, subplot, noHoverEvent) {
|
|
|
111850
111854
|
return;
|
|
111851
111855
|
}
|
|
111852
111856
|
|
|
111853
|
-
|
|
111854
|
-
var target = evt.composedPath && evt.composedPath()[0];
|
|
111855
|
-
if(!target) {
|
|
111856
|
-
// Fallback for browsers not supporting composedPath
|
|
111857
|
-
target = evt.target;
|
|
111858
|
-
}
|
|
111859
|
-
var dbb = target.getBoundingClientRect();
|
|
111857
|
+
var dbb = eventTarget.getBoundingClientRect();
|
|
111860
111858
|
|
|
111861
111859
|
xpx = evt.clientX - dbb.left;
|
|
111862
111860
|
ypx = evt.clientY - dbb.top;
|
|
@@ -112304,15 +112302,15 @@ function _hover(gd, evt, subplot, noHoverEvent) {
|
|
|
112304
112302
|
if(!helpers.isUnifiedHover(hovermode)) {
|
|
112305
112303
|
hoverAvoidOverlaps(hoverLabels, rotateLabels ? 'xa' : 'ya', fullLayout);
|
|
112306
112304
|
alignHoverText(hoverLabels, rotateLabels, fullLayout._invScaleX, fullLayout._invScaleY);
|
|
112307
|
-
} // TODO: tagName hack is needed to appease geo.js's hack of using
|
|
112305
|
+
} // TODO: tagName hack is needed to appease geo.js's hack of using eventTarget=true
|
|
112308
112306
|
// we should improve the "fx" API so other plots can use it without these hack.
|
|
112309
|
-
if(
|
|
112307
|
+
if(eventTarget && eventTarget.tagName) {
|
|
112310
112308
|
var hasClickToShow = Registry.getComponentMethod('annotations', 'hasClickToShow')(gd, newhoverdata);
|
|
112311
|
-
overrideCursor(d3.select(
|
|
112309
|
+
overrideCursor(d3.select(eventTarget), hasClickToShow ? 'pointer' : '');
|
|
112312
112310
|
}
|
|
112313
112311
|
|
|
112314
112312
|
// don't emit events if called manually
|
|
112315
|
-
if(!
|
|
112313
|
+
if(!eventTarget || noHoverEvent || !hoverChanged(gd, evt, oldhoverdata)) return;
|
|
112316
112314
|
|
|
112317
112315
|
if(oldhoverdata) {
|
|
112318
112316
|
gd.emit('plotly_unhover', {
|
|
@@ -136414,7 +136412,8 @@ function findUIPattern(key, patternSpecs) {
|
|
|
136414
136412
|
var spec = patternSpecs[i];
|
|
136415
136413
|
var match = key.match(spec.pattern);
|
|
136416
136414
|
if(match) {
|
|
136417
|
-
|
|
136415
|
+
var head = match[1] || '';
|
|
136416
|
+
return {head: head, tail: key.substr(head.length + 1), attr: spec.attr};
|
|
136418
136417
|
}
|
|
136419
136418
|
}
|
|
136420
136419
|
}
|
|
@@ -136466,26 +136465,54 @@ function valsMatch(v1, v2) {
|
|
|
136466
136465
|
|
|
136467
136466
|
function applyUIRevisions(data, layout, oldFullData, oldFullLayout) {
|
|
136468
136467
|
var layoutPreGUI = oldFullLayout._preGUI;
|
|
136469
|
-
var key, revAttr, oldRev, newRev, match, preGUIVal, newNP, newVal;
|
|
136468
|
+
var key, revAttr, oldRev, newRev, match, preGUIVal, newNP, newVal, head, tail;
|
|
136470
136469
|
var bothInheritAutorange = [];
|
|
136470
|
+
var newAutorangeIn = {};
|
|
136471
136471
|
var newRangeAccepted = {};
|
|
136472
136472
|
for(key in layoutPreGUI) {
|
|
136473
136473
|
match = findUIPattern(key, layoutUIControlPatterns);
|
|
136474
136474
|
if(match) {
|
|
136475
|
-
|
|
136475
|
+
head = match.head;
|
|
136476
|
+
tail = match.tail;
|
|
136477
|
+
revAttr = match.attr || (head + '.uirevision');
|
|
136476
136478
|
oldRev = nestedProperty(oldFullLayout, revAttr).get();
|
|
136477
136479
|
newRev = oldRev && getNewRev(revAttr, layout);
|
|
136480
|
+
|
|
136478
136481
|
if(newRev && (newRev === oldRev)) {
|
|
136479
136482
|
preGUIVal = layoutPreGUI[key];
|
|
136480
136483
|
if(preGUIVal === null) preGUIVal = undefined;
|
|
136481
136484
|
newNP = nestedProperty(layout, key);
|
|
136482
136485
|
newVal = newNP.get();
|
|
136486
|
+
|
|
136483
136487
|
if(valsMatch(newVal, preGUIVal)) {
|
|
136484
|
-
if(newVal === undefined &&
|
|
136485
|
-
bothInheritAutorange.push(
|
|
136488
|
+
if(newVal === undefined && tail === 'autorange') {
|
|
136489
|
+
bothInheritAutorange.push(head);
|
|
136486
136490
|
}
|
|
136487
136491
|
newNP.set(undefinedToNull(nestedProperty(oldFullLayout, key).get()));
|
|
136488
136492
|
continue;
|
|
136493
|
+
} else if(tail === 'autorange' || tail.substr(0, 6) === 'range[') {
|
|
136494
|
+
// Special case for (auto)range since we push it back into the layout
|
|
136495
|
+
// so all null should be treated equivalently to autorange: true with any range
|
|
136496
|
+
var pre0 = layoutPreGUI[head + '.range[0]'];
|
|
136497
|
+
var pre1 = layoutPreGUI[head + '.range[1]'];
|
|
136498
|
+
var preAuto = layoutPreGUI[head + '.autorange'];
|
|
136499
|
+
if(preAuto || (preAuto === null && pre0 === null && pre1 === null)) {
|
|
136500
|
+
// Only read the input layout once and stash the result,
|
|
136501
|
+
// so we get it before we start modifying it
|
|
136502
|
+
if(!(head in newAutorangeIn)) {
|
|
136503
|
+
var newContainer = nestedProperty(layout, head).get();
|
|
136504
|
+
newAutorangeIn[head] = newContainer && (
|
|
136505
|
+
newContainer.autorange ||
|
|
136506
|
+
(newContainer.autorange !== false && (
|
|
136507
|
+
!newContainer.range || newContainer.range.length !== 2)
|
|
136508
|
+
)
|
|
136509
|
+
);
|
|
136510
|
+
}
|
|
136511
|
+
if(newAutorangeIn[head]) {
|
|
136512
|
+
newNP.set(undefinedToNull(nestedProperty(oldFullLayout, key).get()));
|
|
136513
|
+
continue;
|
|
136514
|
+
}
|
|
136515
|
+
}
|
|
136489
136516
|
}
|
|
136490
136517
|
}
|
|
136491
136518
|
} else {
|
|
@@ -136496,12 +136523,12 @@ function applyUIRevisions(data, layout, oldFullData, oldFullLayout) {
|
|
|
136496
136523
|
// so remove it from _preGUI for next time.
|
|
136497
136524
|
delete layoutPreGUI[key];
|
|
136498
136525
|
|
|
136499
|
-
if(
|
|
136500
|
-
newRangeAccepted[
|
|
136526
|
+
if(match && match.tail.substr(0, 6) === 'range[') {
|
|
136527
|
+
newRangeAccepted[match.head] = 1;
|
|
136501
136528
|
}
|
|
136502
136529
|
}
|
|
136503
136530
|
|
|
136504
|
-
//
|
|
136531
|
+
// More special logic for `autorange`, since it interacts with `range`:
|
|
136505
136532
|
// If the new figure's matching `range` was kept, and `autorange`
|
|
136506
136533
|
// wasn't supplied explicitly in either the original or the new figure,
|
|
136507
136534
|
// we shouldn't alter that - but we may just have done that, so fix it.
|
|
@@ -161351,11 +161378,14 @@ proto.project = function(v) {
|
|
|
161351
161378
|
proto.getView = function() {
|
|
161352
161379
|
var map = this.map;
|
|
161353
161380
|
var mapCenter = map.getCenter();
|
|
161354
|
-
var
|
|
161381
|
+
var lon = mapCenter.lng;
|
|
161382
|
+
var lat = mapCenter.lat;
|
|
161383
|
+
var center = { lon: lon, lat: lat };
|
|
161355
161384
|
|
|
161356
161385
|
var canvas = map.getCanvas();
|
|
161357
|
-
var w = canvas.width;
|
|
161358
|
-
var h = canvas.height;
|
|
161386
|
+
var w = parseInt(canvas.style.width);
|
|
161387
|
+
var h = parseInt(canvas.style.height);
|
|
161388
|
+
|
|
161359
161389
|
return {
|
|
161360
161390
|
center: center,
|
|
161361
161391
|
zoom: map.getZoom(),
|
|
@@ -172488,7 +172518,7 @@ function appendBarText(gd, plotinfo, bar, cd, i, x0, x1, y0, y1, opts, makeOnCom
|
|
|
172488
172518
|
}
|
|
172489
172519
|
|
|
172490
172520
|
transform.fontSize = font.size;
|
|
172491
|
-
recordMinTextSize(trace.type, transform, fullLayout);
|
|
172521
|
+
recordMinTextSize(trace.type === 'histogram' ? 'bar' : trace.type, transform, fullLayout);
|
|
172492
172522
|
calcBar.transform = transform;
|
|
172493
172523
|
|
|
172494
172524
|
transition(textSelection, fullLayout, opts, makeOnCompleteCallback)
|
|
@@ -186820,6 +186850,8 @@ module.exports = {
|
|
|
186820
186850
|
var barAttrs = _dereq_('../bar/attributes');
|
|
186821
186851
|
var axisHoverFormat = _dereq_('../../plots/cartesian/axis_format_attributes').axisHoverFormat;
|
|
186822
186852
|
var hovertemplateAttrs = _dereq_('../../plots/template_attributes').hovertemplateAttrs;
|
|
186853
|
+
var texttemplateAttrs = _dereq_('../../plots/template_attributes').texttemplateAttrs;
|
|
186854
|
+
var fontAttrs = _dereq_('../../plots/font_attributes');
|
|
186823
186855
|
var makeBinAttrs = _dereq_('./bin_attributes');
|
|
186824
186856
|
var constants = _dereq_('./constants');
|
|
186825
186857
|
var extendFlat = _dereq_('../../lib/extend').extendFlat;
|
|
@@ -186914,6 +186946,41 @@ module.exports = {
|
|
|
186914
186946
|
keys: constants.eventDataKeys
|
|
186915
186947
|
}),
|
|
186916
186948
|
|
|
186949
|
+
texttemplate: texttemplateAttrs({
|
|
186950
|
+
arrayOk: false,
|
|
186951
|
+
editType: 'plot'
|
|
186952
|
+
}, {
|
|
186953
|
+
keys: ['label', 'value']
|
|
186954
|
+
}),
|
|
186955
|
+
|
|
186956
|
+
textposition: extendFlat({}, barAttrs.textposition, {
|
|
186957
|
+
arrayOk: false
|
|
186958
|
+
}),
|
|
186959
|
+
|
|
186960
|
+
textfont: fontAttrs({
|
|
186961
|
+
arrayOk: false,
|
|
186962
|
+
editType: 'plot',
|
|
186963
|
+
colorEditType: 'style',
|
|
186964
|
+
}),
|
|
186965
|
+
|
|
186966
|
+
outsidetextfont: fontAttrs({
|
|
186967
|
+
arrayOk: false,
|
|
186968
|
+
editType: 'plot',
|
|
186969
|
+
colorEditType: 'style',
|
|
186970
|
+
}),
|
|
186971
|
+
|
|
186972
|
+
insidetextfont: fontAttrs({
|
|
186973
|
+
arrayOk: false,
|
|
186974
|
+
editType: 'plot',
|
|
186975
|
+
colorEditType: 'style',
|
|
186976
|
+
}),
|
|
186977
|
+
|
|
186978
|
+
insidetextanchor: barAttrs.insidetextanchor,
|
|
186979
|
+
|
|
186980
|
+
textangle: barAttrs.textangle,
|
|
186981
|
+
cliponaxis: barAttrs.cliponaxis,
|
|
186982
|
+
constraintext: barAttrs.constraintext,
|
|
186983
|
+
|
|
186917
186984
|
marker: barAttrs.marker,
|
|
186918
186985
|
|
|
186919
186986
|
offsetgroup: barAttrs.offsetgroup,
|
|
@@ -186927,7 +186994,7 @@ module.exports = {
|
|
|
186927
186994
|
}
|
|
186928
186995
|
};
|
|
186929
186996
|
|
|
186930
|
-
},{"../../lib/extend":493,"../../plots/cartesian/axis_format_attributes":557,"../../plots/template_attributes":633,"../bar/attributes":648,"./bin_attributes":813,"./constants":817}],812:[function(_dereq_,module,exports){
|
|
186997
|
+
},{"../../lib/extend":493,"../../plots/cartesian/axis_format_attributes":557,"../../plots/font_attributes":585,"../../plots/template_attributes":633,"../bar/attributes":648,"./bin_attributes":813,"./constants":817}],812:[function(_dereq_,module,exports){
|
|
186931
186998
|
'use strict';
|
|
186932
186999
|
|
|
186933
187000
|
|
|
@@ -188050,6 +188117,7 @@ var Registry = _dereq_('../../registry');
|
|
|
188050
188117
|
var Lib = _dereq_('../../lib');
|
|
188051
188118
|
var Color = _dereq_('../../components/color');
|
|
188052
188119
|
|
|
188120
|
+
var handleText = _dereq_('../bar/defaults').handleText;
|
|
188053
188121
|
var handleStyleDefaults = _dereq_('../bar/style_defaults');
|
|
188054
188122
|
var attributes = _dereq_('./attributes');
|
|
188055
188123
|
|
|
@@ -188068,6 +188136,16 @@ module.exports = function supplyDefaults(traceIn, traceOut, defaultColor, layout
|
|
|
188068
188136
|
}
|
|
188069
188137
|
|
|
188070
188138
|
coerce('text');
|
|
188139
|
+
var textposition = coerce('textposition');
|
|
188140
|
+
handleText(traceIn, traceOut, layout, coerce, textposition, {
|
|
188141
|
+
moduleHasSelected: true,
|
|
188142
|
+
moduleHasUnselected: true,
|
|
188143
|
+
moduleHasConstrain: true,
|
|
188144
|
+
moduleHasCliponaxis: true,
|
|
188145
|
+
moduleHasTextangle: true,
|
|
188146
|
+
moduleHasInsideanchor: true
|
|
188147
|
+
});
|
|
188148
|
+
|
|
188071
188149
|
coerce('hovertext');
|
|
188072
188150
|
coerce('hovertemplate');
|
|
188073
188151
|
coerce('xhoverformat');
|
|
@@ -188111,7 +188189,7 @@ module.exports = function supplyDefaults(traceIn, traceOut, defaultColor, layout
|
|
|
188111
188189
|
errorBarsSupplyDefaults(traceIn, traceOut, lineColor || Color.defaultLine, {axis: 'x', inherit: 'y'});
|
|
188112
188190
|
};
|
|
188113
188191
|
|
|
188114
|
-
},{"../../components/color":366,"../../lib":503,"../../registry":638,"../bar/style_defaults":663,"./attributes":811}],820:[function(_dereq_,module,exports){
|
|
188192
|
+
},{"../../components/color":366,"../../lib":503,"../../registry":638,"../bar/defaults":652,"../bar/style_defaults":663,"./attributes":811}],820:[function(_dereq_,module,exports){
|
|
188115
188193
|
'use strict';
|
|
188116
188194
|
|
|
188117
188195
|
module.exports = function eventData(out, pt, trace, cd, pointNumber) {
|
|
@@ -223435,7 +223513,7 @@ function getSortFunc(opts, d2c) {
|
|
|
223435
223513
|
'use strict';
|
|
223436
223514
|
|
|
223437
223515
|
// package version injected by `npm run preprocess`
|
|
223438
|
-
exports.version = '2.
|
|
223516
|
+
exports.version = '2.7.0';
|
|
223439
223517
|
|
|
223440
223518
|
},{}],1119:[function(_dereq_,module,exports){
|
|
223441
223519
|
(function (global){(function (){
|