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-with-meta.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
|
-
}
|
|
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
97251
|
}
|
|
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) {
|
|
@@ -106734,6 +106722,19 @@ function makeColorBarData(gd) {
|
|
|
106734
106722
|
}
|
|
106735
106723
|
|
|
106736
106724
|
function drawColorBar(g, opts, gd) {
|
|
106725
|
+
var len = opts.len;
|
|
106726
|
+
var lenmode = opts.lenmode;
|
|
106727
|
+
var thickness = opts.thickness;
|
|
106728
|
+
var thicknessmode = opts.thicknessmode;
|
|
106729
|
+
var outlinewidth = opts.outlinewidth;
|
|
106730
|
+
var borderwidth = opts.borderwidth;
|
|
106731
|
+
var xanchor = opts.xanchor;
|
|
106732
|
+
var yanchor = opts.yanchor;
|
|
106733
|
+
var xpad = opts.xpad;
|
|
106734
|
+
var ypad = opts.ypad;
|
|
106735
|
+
var optsX = opts.x;
|
|
106736
|
+
var optsY = opts.y;
|
|
106737
|
+
|
|
106737
106738
|
var fullLayout = gd._fullLayout;
|
|
106738
106739
|
var gs = fullLayout._size;
|
|
106739
106740
|
|
|
@@ -106763,42 +106764,41 @@ function drawColorBar(g, opts, gd) {
|
|
|
106763
106764
|
// when the colorbar itself is pushing the margins.
|
|
106764
106765
|
// but then the fractional size is calculated based on the
|
|
106765
106766
|
// actual graph size, so that the axes will size correctly.
|
|
106766
|
-
var thickPx = Math.round(
|
|
106767
|
+
var thickPx = Math.round(thickness * (thicknessmode === 'fraction' ? gs.w : 1));
|
|
106767
106768
|
var thickFrac = thickPx / gs.w;
|
|
106768
|
-
var lenPx = Math.round(
|
|
106769
|
+
var lenPx = Math.round(len * (lenmode === 'fraction' ? gs.h : 1));
|
|
106769
106770
|
var lenFrac = lenPx / gs.h;
|
|
106770
|
-
var xpadFrac =
|
|
106771
|
-
var yExtraPx = (
|
|
106772
|
-
var ypadFrac =
|
|
106771
|
+
var xpadFrac = xpad / gs.w;
|
|
106772
|
+
var yExtraPx = (borderwidth + outlinewidth) / 2;
|
|
106773
|
+
var ypadFrac = ypad / gs.h;
|
|
106773
106774
|
|
|
106774
106775
|
// x positioning: do it initially just for left anchor,
|
|
106775
106776
|
// then fix at the end (since we don't know the width yet)
|
|
106776
|
-
var
|
|
106777
|
+
var uPx = Math.round(optsX * gs.w + xpad);
|
|
106777
106778
|
// for dragging... this is getting a little muddled...
|
|
106778
|
-
var
|
|
106779
|
+
var uFrac = optsX - thickFrac * ({center: 0.5, right: 1}[xanchor] || 0);
|
|
106779
106780
|
|
|
106780
106781
|
// y positioning we can do correctly from the start
|
|
106781
|
-
var
|
|
106782
|
-
var
|
|
106783
|
-
var yTopPx = yBottomPx - lenPx;
|
|
106782
|
+
var vFrac = optsY + lenFrac * (({top: -0.5, bottom: 0.5}[yanchor] || 0) - 0.5);
|
|
106783
|
+
var vPx = Math.round(gs.h * (1 - vFrac));
|
|
106784
106784
|
|
|
106785
106785
|
// stash a few things for makeEditable
|
|
106786
106786
|
opts._lenFrac = lenFrac;
|
|
106787
106787
|
opts._thickFrac = thickFrac;
|
|
106788
|
-
opts.
|
|
106789
|
-
opts.
|
|
106788
|
+
opts._uFrac = uFrac;
|
|
106789
|
+
opts._vFrac = vFrac;
|
|
106790
106790
|
|
|
106791
106791
|
// stash mocked axis for contour label formatting
|
|
106792
106792
|
var ax = opts._axis = mockColorBarAxis(gd, opts, zrange);
|
|
106793
106793
|
|
|
106794
106794
|
// position can't go in through supplyDefaults
|
|
106795
106795
|
// because that restricts it to [0,1]
|
|
106796
|
-
ax.position =
|
|
106796
|
+
ax.position = optsX + xpadFrac + thickFrac;
|
|
106797
106797
|
|
|
106798
106798
|
if(['top', 'bottom'].indexOf(titleSide) !== -1) {
|
|
106799
106799
|
ax.title.side = titleSide;
|
|
106800
|
-
ax.titlex =
|
|
106801
|
-
ax.titley =
|
|
106800
|
+
ax.titlex = optsX + xpadFrac;
|
|
106801
|
+
ax.titley = vFrac + (title.side === 'top' ? lenFrac - ypadFrac : ypadFrac);
|
|
106802
106802
|
}
|
|
106803
106803
|
|
|
106804
106804
|
if(line.color && opts.tickmode === 'auto') {
|
|
@@ -106806,7 +106806,7 @@ function drawColorBar(g, opts, gd) {
|
|
|
106806
106806
|
ax.tick0 = levelsIn.start;
|
|
106807
106807
|
var dtick = levelsIn.size;
|
|
106808
106808
|
// expand if too many contours, so we don't get too many ticks
|
|
106809
|
-
var autoNtick = Lib.constrain(
|
|
106809
|
+
var autoNtick = Lib.constrain(lenPx / 50, 4, 15) + 1;
|
|
106810
106810
|
var dtFactor = (zrange[1] - zrange[0]) / ((opts.nticks || autoNtick) * dtick);
|
|
106811
106811
|
if(dtFactor > 1) {
|
|
106812
106812
|
var dtexp = Math.pow(10, Math.floor(Math.log(dtFactor) / Math.LN10));
|
|
@@ -106824,8 +106824,8 @@ function drawColorBar(g, opts, gd) {
|
|
|
106824
106824
|
// set domain after init, because we may want to
|
|
106825
106825
|
// allow it outside [0,1]
|
|
106826
106826
|
ax.domain = [
|
|
106827
|
-
|
|
106828
|
-
|
|
106827
|
+
vFrac + ypadFrac,
|
|
106828
|
+
vFrac + lenFrac - ypadFrac
|
|
106829
106829
|
];
|
|
106830
106830
|
|
|
106831
106831
|
ax.setScale();
|
|
@@ -106866,15 +106866,15 @@ function drawColorBar(g, opts, gd) {
|
|
|
106866
106866
|
// draw the title so we know how much room it needs
|
|
106867
106867
|
// when we squish the axis. This one only applies to
|
|
106868
106868
|
// top or bottom titles, not right side.
|
|
106869
|
-
var x = gs.l + (
|
|
106869
|
+
var x = gs.l + (optsX + xpadFrac) * gs.w;
|
|
106870
106870
|
var fontSize = ax.title.font.size;
|
|
106871
106871
|
var y;
|
|
106872
106872
|
|
|
106873
106873
|
if(titleSide === 'top') {
|
|
106874
|
-
y = (1 - (
|
|
106874
|
+
y = (1 - (vFrac + lenFrac - ypadFrac)) * gs.h +
|
|
106875
106875
|
gs.t + 3 + fontSize * 0.75;
|
|
106876
106876
|
} else {
|
|
106877
|
-
y = (1 - (
|
|
106877
|
+
y = (1 - (vFrac + ypadFrac)) * gs.h +
|
|
106878
106878
|
gs.t - 3 - fontSize * 0.25;
|
|
106879
106879
|
}
|
|
106880
106880
|
drawTitle(ax._id + 'title', {
|
|
@@ -106913,7 +106913,7 @@ function drawColorBar(g, opts, gd) {
|
|
|
106913
106913
|
// squish the axis top to make room for the title
|
|
106914
106914
|
var titleGroup = g.select('.' + cn.cbtitle);
|
|
106915
106915
|
var titleText = titleGroup.select('text');
|
|
106916
|
-
var titleTrans = [-
|
|
106916
|
+
var titleTrans = [-outlinewidth / 2, outlinewidth / 2];
|
|
106917
106917
|
var mathJaxNode = titleGroup
|
|
106918
106918
|
.select('.h' + ax._id + 'title-math-group')
|
|
106919
106919
|
.node();
|
|
@@ -106985,7 +106985,7 @@ function drawColorBar(g, opts, gd) {
|
|
|
106985
106985
|
// Colorbar cannot currently support opacities so we
|
|
106986
106986
|
// use an opaque fill even when alpha channels present
|
|
106987
106987
|
var fillEl = d3.select(this).attr({
|
|
106988
|
-
x:
|
|
106988
|
+
x: uPx,
|
|
106989
106989
|
width: Math.max(thickPx, 2),
|
|
106990
106990
|
y: d3.min(z),
|
|
106991
106991
|
height: Math.max(d3.max(z) - d3.min(z), 2),
|
|
@@ -107009,7 +107009,7 @@ function drawColorBar(g, opts, gd) {
|
|
|
107009
107009
|
lines.exit().remove();
|
|
107010
107010
|
lines.each(function(d) {
|
|
107011
107011
|
d3.select(this)
|
|
107012
|
-
.attr('d', 'M' +
|
|
107012
|
+
.attr('d', 'M' + uPx + ',' +
|
|
107013
107013
|
(Math.round(ax.c2p(d)) + (line.width / 2) % 1) + 'h' + thickPx)
|
|
107014
107014
|
.call(Drawing.lineGroupStyle, line.width, lineColormap(d), line.dash);
|
|
107015
107015
|
});
|
|
@@ -107017,8 +107017,8 @@ function drawColorBar(g, opts, gd) {
|
|
|
107017
107017
|
// force full redraw of labels and ticks
|
|
107018
107018
|
axLayer.selectAll('g.' + ax._id + 'tick,path').remove();
|
|
107019
107019
|
|
|
107020
|
-
var shift =
|
|
107021
|
-
(
|
|
107020
|
+
var shift = uPx + thickPx +
|
|
107021
|
+
(outlinewidth || 0) / 2 - (opts.ticks === 'outside' ? 1 : 0);
|
|
107022
107022
|
|
|
107023
107023
|
var vals = Axes.calcTicks(ax);
|
|
107024
107024
|
var tickSign = Axes.getTickSigns(ax)[2];
|
|
@@ -107043,9 +107043,9 @@ function drawColorBar(g, opts, gd) {
|
|
|
107043
107043
|
// TODO: why are we redrawing multiple times now with this?
|
|
107044
107044
|
// I guess autoMargin doesn't like being post-promise?
|
|
107045
107045
|
function positionCB() {
|
|
107046
|
-
var
|
|
107046
|
+
var innerThickness = thickPx + outlinewidth / 2;
|
|
107047
107047
|
if(ax.ticklabelposition.indexOf('inside') === -1) {
|
|
107048
|
-
|
|
107048
|
+
innerThickness += Drawing.bBox(axLayer.node()).width;
|
|
107049
107049
|
}
|
|
107050
107050
|
|
|
107051
107051
|
titleEl = titleCont.select('text');
|
|
@@ -107060,66 +107060,65 @@ function drawColorBar(g, opts, gd) {
|
|
|
107060
107060
|
// (except for top/bottom mathjax, above)
|
|
107061
107061
|
// but the weird gs.l is because the titleunshift
|
|
107062
107062
|
// transform gets removed by Drawing.bBox
|
|
107063
|
-
titleWidth = Drawing.bBox(titleCont.node()).right -
|
|
107063
|
+
titleWidth = Drawing.bBox(titleCont.node()).right - uPx - gs.l;
|
|
107064
107064
|
}
|
|
107065
|
-
|
|
107065
|
+
innerThickness = Math.max(innerThickness, titleWidth);
|
|
107066
107066
|
}
|
|
107067
107067
|
|
|
107068
|
-
var
|
|
107069
|
-
var outerheight = yBottomPx - yTopPx;
|
|
107068
|
+
var outerThickness = 2 * xpad + innerThickness + borderwidth + outlinewidth / 2;
|
|
107070
107069
|
|
|
107071
107070
|
g.select('.' + cn.cbbg).attr({
|
|
107072
|
-
x:
|
|
107073
|
-
y:
|
|
107074
|
-
width: Math.max(
|
|
107075
|
-
height: Math.max(
|
|
107071
|
+
x: uPx - xpad - (borderwidth + outlinewidth) / 2,
|
|
107072
|
+
y: vPx - lenPx - yExtraPx,
|
|
107073
|
+
width: Math.max(outerThickness, 2),
|
|
107074
|
+
height: Math.max(lenPx + 2 * yExtraPx, 2)
|
|
107076
107075
|
})
|
|
107077
107076
|
.call(Color.fill, opts.bgcolor)
|
|
107078
107077
|
.call(Color.stroke, opts.bordercolor)
|
|
107079
|
-
.style('stroke-width',
|
|
107078
|
+
.style('stroke-width', borderwidth);
|
|
107080
107079
|
|
|
107081
107080
|
g.selectAll('.' + cn.cboutline).attr({
|
|
107082
|
-
x:
|
|
107083
|
-
y:
|
|
107081
|
+
x: uPx,
|
|
107082
|
+
y: vPx - lenPx + ypad + (titleSide === 'top' ? titleHeight : 0),
|
|
107084
107083
|
width: Math.max(thickPx, 2),
|
|
107085
|
-
height: Math.max(
|
|
107084
|
+
height: Math.max(lenPx - 2 * ypad - titleHeight, 2)
|
|
107086
107085
|
})
|
|
107087
107086
|
.call(Color.stroke, opts.outlinecolor)
|
|
107088
107087
|
.style({
|
|
107089
107088
|
fill: 'none',
|
|
107090
|
-
'stroke-width':
|
|
107089
|
+
'stroke-width': outlinewidth
|
|
107091
107090
|
});
|
|
107092
107091
|
|
|
107093
107092
|
// fix positioning for xanchor!='left'
|
|
107094
|
-
var xoffset = ({center: 0.5, right: 1}[
|
|
107093
|
+
var xoffset = ({center: 0.5, right: 1}[xanchor] || 0) * outerThickness;
|
|
107095
107094
|
g.attr('transform', strTranslate(gs.l - xoffset, gs.t));
|
|
107096
107095
|
|
|
107097
107096
|
// auto margin adjustment
|
|
107098
107097
|
var marginOpts = {};
|
|
107099
|
-
var tFrac = FROM_TL[
|
|
107100
|
-
var bFrac = FROM_BR[
|
|
107101
|
-
if(
|
|
107102
|
-
marginOpts.y =
|
|
107103
|
-
marginOpts.t =
|
|
107104
|
-
marginOpts.b =
|
|
107098
|
+
var tFrac = FROM_TL[yanchor];
|
|
107099
|
+
var bFrac = FROM_BR[yanchor];
|
|
107100
|
+
if(lenmode === 'pixels') {
|
|
107101
|
+
marginOpts.y = optsY;
|
|
107102
|
+
marginOpts.t = lenPx * tFrac;
|
|
107103
|
+
marginOpts.b = lenPx * bFrac;
|
|
107105
107104
|
} else {
|
|
107106
107105
|
marginOpts.t = marginOpts.b = 0;
|
|
107107
|
-
marginOpts.yt =
|
|
107108
|
-
marginOpts.yb =
|
|
107106
|
+
marginOpts.yt = optsY + len * tFrac;
|
|
107107
|
+
marginOpts.yb = optsY - len * bFrac;
|
|
107109
107108
|
}
|
|
107110
107109
|
|
|
107111
|
-
var lFrac = FROM_TL[
|
|
107112
|
-
var rFrac = FROM_BR[
|
|
107113
|
-
if(
|
|
107114
|
-
marginOpts.x =
|
|
107115
|
-
marginOpts.l =
|
|
107116
|
-
marginOpts.r =
|
|
107110
|
+
var lFrac = FROM_TL[xanchor];
|
|
107111
|
+
var rFrac = FROM_BR[xanchor];
|
|
107112
|
+
if(thicknessmode === 'pixels') {
|
|
107113
|
+
marginOpts.x = optsX;
|
|
107114
|
+
marginOpts.l = outerThickness * lFrac;
|
|
107115
|
+
marginOpts.r = outerThickness * rFrac;
|
|
107117
107116
|
} else {
|
|
107118
|
-
var extraThickness =
|
|
107117
|
+
var extraThickness = outerThickness - thickPx;
|
|
107119
107118
|
marginOpts.l = extraThickness * lFrac;
|
|
107120
107119
|
marginOpts.r = extraThickness * rFrac;
|
|
107121
|
-
marginOpts.xl =
|
|
107122
|
-
marginOpts.xr =
|
|
107120
|
+
marginOpts.xl = optsX - thickness * lFrac;
|
|
107121
|
+
marginOpts.xr = optsX + thickness * rFrac;
|
|
107123
107122
|
}
|
|
107124
107123
|
|
|
107125
107124
|
Plots.autoMargin(gd, opts._id, marginOpts);
|
|
@@ -107150,9 +107149,9 @@ function makeEditable(g, opts, gd) {
|
|
|
107150
107149
|
moveFn: function(dx, dy) {
|
|
107151
107150
|
g.attr('transform', t0 + strTranslate(dx, dy));
|
|
107152
107151
|
|
|
107153
|
-
xf = dragElement.align(opts.
|
|
107152
|
+
xf = dragElement.align(opts._uFrac + (dx / gs.w), opts._thickFrac,
|
|
107154
107153
|
0, 1, opts.xanchor);
|
|
107155
|
-
yf = dragElement.align(opts.
|
|
107154
|
+
yf = dragElement.align(opts._vFrac - (dy / gs.h), opts._lenFrac,
|
|
107156
107155
|
0, 1, opts.yanchor);
|
|
107157
107156
|
|
|
107158
107157
|
var csr = dragElement.getCursor(xf, yf, opts.xanchor, opts.yanchor);
|
|
@@ -109860,7 +109859,7 @@ var TEXTOFFSETSIGN = {
|
|
|
109860
109859
|
start: 1, end: -1, middle: 0, bottom: 1, top: -1
|
|
109861
109860
|
};
|
|
109862
109861
|
|
|
109863
|
-
function textPointPosition(s, textPosition, fontSize, markerRadius) {
|
|
109862
|
+
function textPointPosition(s, textPosition, fontSize, markerRadius, dontTouchParent) {
|
|
109864
109863
|
var group = d3.select(s.node().parentNode);
|
|
109865
109864
|
|
|
109866
109865
|
var v = textPosition.indexOf('top') !== -1 ?
|
|
@@ -109882,7 +109881,9 @@ function textPointPosition(s, textPosition, fontSize, markerRadius) {
|
|
|
109882
109881
|
|
|
109883
109882
|
// fix the overall text group position
|
|
109884
109883
|
s.attr('text-anchor', h);
|
|
109885
|
-
|
|
109884
|
+
if(!dontTouchParent) {
|
|
109885
|
+
group.attr('transform', strTranslate(dx, dy));
|
|
109886
|
+
}
|
|
109886
109887
|
}
|
|
109887
109888
|
|
|
109888
109889
|
function extracTextFontSize(d, trace) {
|
|
@@ -109952,7 +109953,8 @@ drawing.selectedTextStyle = function(s, trace) {
|
|
|
109952
109953
|
var fontSize = extracTextFontSize(d, trace);
|
|
109953
109954
|
|
|
109954
109955
|
Color.fill(tx, tc);
|
|
109955
|
-
|
|
109956
|
+
var dontTouchParent = Registry.traceIs(trace, 'bar-like');
|
|
109957
|
+
textPointPosition(tx, tp, fontSize, d.mrc2 || d.mrc, dontTouchParent);
|
|
109956
109958
|
});
|
|
109957
109959
|
};
|
|
109958
109960
|
|
|
@@ -112040,11 +112042,13 @@ var cartesianScatterPoints = {
|
|
|
112040
112042
|
// The actual rendering is done by private function _hover.
|
|
112041
112043
|
exports.hover = function hover(gd, evt, subplot, noHoverEvent) {
|
|
112042
112044
|
gd = Lib.getGraphDiv(gd);
|
|
112043
|
-
|
|
112045
|
+
// The 'target' property changes when bubbling out of Shadow DOM.
|
|
112046
|
+
// Throttling can delay reading the target, so we save the current value.
|
|
112047
|
+
var eventTarget = evt.target;
|
|
112044
112048
|
Lib.throttle(
|
|
112045
112049
|
gd._fullLayout._uid + constants.HOVERID,
|
|
112046
112050
|
constants.HOVERMINTIME,
|
|
112047
|
-
function() { _hover(gd, evt, subplot, noHoverEvent); }
|
|
112051
|
+
function() { _hover(gd, evt, subplot, noHoverEvent, eventTarget); }
|
|
112048
112052
|
);
|
|
112049
112053
|
};
|
|
112050
112054
|
|
|
@@ -112209,7 +112213,7 @@ exports.loneHover = function loneHover(hoverItems, opts) {
|
|
|
112209
112213
|
};
|
|
112210
112214
|
|
|
112211
112215
|
// The actual implementation is here:
|
|
112212
|
-
function _hover(gd, evt, subplot, noHoverEvent) {
|
|
112216
|
+
function _hover(gd, evt, subplot, noHoverEvent, eventTarget) {
|
|
112213
112217
|
if(!subplot) subplot = 'xy';
|
|
112214
112218
|
|
|
112215
112219
|
// if the user passed in an array of subplots,
|
|
@@ -112328,7 +112332,7 @@ function _hover(gd, evt, subplot, noHoverEvent) {
|
|
|
112328
112332
|
// [x|y]px: the pixels (from top left) of the mouse location
|
|
112329
112333
|
// on the currently selected plot area
|
|
112330
112334
|
// add pointerX|Y property for drawing the spikes in spikesnap 'cursor' situation
|
|
112331
|
-
var hasUserCalledHover = !
|
|
112335
|
+
var hasUserCalledHover = !eventTarget;
|
|
112332
112336
|
var xpx, ypx;
|
|
112333
112337
|
|
|
112334
112338
|
if(hasUserCalledHover) {
|
|
@@ -112345,13 +112349,7 @@ function _hover(gd, evt, subplot, noHoverEvent) {
|
|
|
112345
112349
|
return;
|
|
112346
112350
|
}
|
|
112347
112351
|
|
|
112348
|
-
|
|
112349
|
-
var target = evt.composedPath && evt.composedPath()[0];
|
|
112350
|
-
if(!target) {
|
|
112351
|
-
// Fallback for browsers not supporting composedPath
|
|
112352
|
-
target = evt.target;
|
|
112353
|
-
}
|
|
112354
|
-
var dbb = target.getBoundingClientRect();
|
|
112352
|
+
var dbb = eventTarget.getBoundingClientRect();
|
|
112355
112353
|
|
|
112356
112354
|
xpx = evt.clientX - dbb.left;
|
|
112357
112355
|
ypx = evt.clientY - dbb.top;
|
|
@@ -112799,15 +112797,15 @@ function _hover(gd, evt, subplot, noHoverEvent) {
|
|
|
112799
112797
|
if(!helpers.isUnifiedHover(hovermode)) {
|
|
112800
112798
|
hoverAvoidOverlaps(hoverLabels, rotateLabels ? 'xa' : 'ya', fullLayout);
|
|
112801
112799
|
alignHoverText(hoverLabels, rotateLabels, fullLayout._invScaleX, fullLayout._invScaleY);
|
|
112802
|
-
} // TODO: tagName hack is needed to appease geo.js's hack of using
|
|
112800
|
+
} // TODO: tagName hack is needed to appease geo.js's hack of using eventTarget=true
|
|
112803
112801
|
// we should improve the "fx" API so other plots can use it without these hack.
|
|
112804
|
-
if(
|
|
112802
|
+
if(eventTarget && eventTarget.tagName) {
|
|
112805
112803
|
var hasClickToShow = Registry.getComponentMethod('annotations', 'hasClickToShow')(gd, newhoverdata);
|
|
112806
|
-
overrideCursor(d3.select(
|
|
112804
|
+
overrideCursor(d3.select(eventTarget), hasClickToShow ? 'pointer' : '');
|
|
112807
112805
|
}
|
|
112808
112806
|
|
|
112809
112807
|
// don't emit events if called manually
|
|
112810
|
-
if(!
|
|
112808
|
+
if(!eventTarget || noHoverEvent || !hoverChanged(gd, evt, oldhoverdata)) return;
|
|
112811
112809
|
|
|
112812
112810
|
if(oldhoverdata) {
|
|
112813
112811
|
gd.emit('plotly_unhover', {
|
|
@@ -137733,7 +137731,8 @@ function findUIPattern(key, patternSpecs) {
|
|
|
137733
137731
|
var spec = patternSpecs[i];
|
|
137734
137732
|
var match = key.match(spec.pattern);
|
|
137735
137733
|
if(match) {
|
|
137736
|
-
|
|
137734
|
+
var head = match[1] || '';
|
|
137735
|
+
return {head: head, tail: key.substr(head.length + 1), attr: spec.attr};
|
|
137737
137736
|
}
|
|
137738
137737
|
}
|
|
137739
137738
|
}
|
|
@@ -137785,26 +137784,54 @@ function valsMatch(v1, v2) {
|
|
|
137785
137784
|
|
|
137786
137785
|
function applyUIRevisions(data, layout, oldFullData, oldFullLayout) {
|
|
137787
137786
|
var layoutPreGUI = oldFullLayout._preGUI;
|
|
137788
|
-
var key, revAttr, oldRev, newRev, match, preGUIVal, newNP, newVal;
|
|
137787
|
+
var key, revAttr, oldRev, newRev, match, preGUIVal, newNP, newVal, head, tail;
|
|
137789
137788
|
var bothInheritAutorange = [];
|
|
137789
|
+
var newAutorangeIn = {};
|
|
137790
137790
|
var newRangeAccepted = {};
|
|
137791
137791
|
for(key in layoutPreGUI) {
|
|
137792
137792
|
match = findUIPattern(key, layoutUIControlPatterns);
|
|
137793
137793
|
if(match) {
|
|
137794
|
-
|
|
137794
|
+
head = match.head;
|
|
137795
|
+
tail = match.tail;
|
|
137796
|
+
revAttr = match.attr || (head + '.uirevision');
|
|
137795
137797
|
oldRev = nestedProperty(oldFullLayout, revAttr).get();
|
|
137796
137798
|
newRev = oldRev && getNewRev(revAttr, layout);
|
|
137799
|
+
|
|
137797
137800
|
if(newRev && (newRev === oldRev)) {
|
|
137798
137801
|
preGUIVal = layoutPreGUI[key];
|
|
137799
137802
|
if(preGUIVal === null) preGUIVal = undefined;
|
|
137800
137803
|
newNP = nestedProperty(layout, key);
|
|
137801
137804
|
newVal = newNP.get();
|
|
137805
|
+
|
|
137802
137806
|
if(valsMatch(newVal, preGUIVal)) {
|
|
137803
|
-
if(newVal === undefined &&
|
|
137804
|
-
bothInheritAutorange.push(
|
|
137807
|
+
if(newVal === undefined && tail === 'autorange') {
|
|
137808
|
+
bothInheritAutorange.push(head);
|
|
137805
137809
|
}
|
|
137806
137810
|
newNP.set(undefinedToNull(nestedProperty(oldFullLayout, key).get()));
|
|
137807
137811
|
continue;
|
|
137812
|
+
} else if(tail === 'autorange' || tail.substr(0, 6) === 'range[') {
|
|
137813
|
+
// Special case for (auto)range since we push it back into the layout
|
|
137814
|
+
// so all null should be treated equivalently to autorange: true with any range
|
|
137815
|
+
var pre0 = layoutPreGUI[head + '.range[0]'];
|
|
137816
|
+
var pre1 = layoutPreGUI[head + '.range[1]'];
|
|
137817
|
+
var preAuto = layoutPreGUI[head + '.autorange'];
|
|
137818
|
+
if(preAuto || (preAuto === null && pre0 === null && pre1 === null)) {
|
|
137819
|
+
// Only read the input layout once and stash the result,
|
|
137820
|
+
// so we get it before we start modifying it
|
|
137821
|
+
if(!(head in newAutorangeIn)) {
|
|
137822
|
+
var newContainer = nestedProperty(layout, head).get();
|
|
137823
|
+
newAutorangeIn[head] = newContainer && (
|
|
137824
|
+
newContainer.autorange ||
|
|
137825
|
+
(newContainer.autorange !== false && (
|
|
137826
|
+
!newContainer.range || newContainer.range.length !== 2)
|
|
137827
|
+
)
|
|
137828
|
+
);
|
|
137829
|
+
}
|
|
137830
|
+
if(newAutorangeIn[head]) {
|
|
137831
|
+
newNP.set(undefinedToNull(nestedProperty(oldFullLayout, key).get()));
|
|
137832
|
+
continue;
|
|
137833
|
+
}
|
|
137834
|
+
}
|
|
137808
137835
|
}
|
|
137809
137836
|
}
|
|
137810
137837
|
} else {
|
|
@@ -137815,12 +137842,12 @@ function applyUIRevisions(data, layout, oldFullData, oldFullLayout) {
|
|
|
137815
137842
|
// so remove it from _preGUI for next time.
|
|
137816
137843
|
delete layoutPreGUI[key];
|
|
137817
137844
|
|
|
137818
|
-
if(
|
|
137819
|
-
newRangeAccepted[
|
|
137845
|
+
if(match && match.tail.substr(0, 6) === 'range[') {
|
|
137846
|
+
newRangeAccepted[match.head] = 1;
|
|
137820
137847
|
}
|
|
137821
137848
|
}
|
|
137822
137849
|
|
|
137823
|
-
//
|
|
137850
|
+
// More special logic for `autorange`, since it interacts with `range`:
|
|
137824
137851
|
// If the new figure's matching `range` was kept, and `autorange`
|
|
137825
137852
|
// wasn't supplied explicitly in either the original or the new figure,
|
|
137826
137853
|
// we shouldn't alter that - but we may just have done that, so fix it.
|
|
@@ -164181,11 +164208,14 @@ proto.project = function(v) {
|
|
|
164181
164208
|
proto.getView = function() {
|
|
164182
164209
|
var map = this.map;
|
|
164183
164210
|
var mapCenter = map.getCenter();
|
|
164184
|
-
var
|
|
164211
|
+
var lon = mapCenter.lng;
|
|
164212
|
+
var lat = mapCenter.lat;
|
|
164213
|
+
var center = { lon: lon, lat: lat };
|
|
164185
164214
|
|
|
164186
164215
|
var canvas = map.getCanvas();
|
|
164187
|
-
var w = canvas.width;
|
|
164188
|
-
var h = canvas.height;
|
|
164216
|
+
var w = parseInt(canvas.style.width);
|
|
164217
|
+
var h = parseInt(canvas.style.height);
|
|
164218
|
+
|
|
164189
164219
|
return {
|
|
164190
164220
|
center: center,
|
|
164191
164221
|
zoom: map.getZoom(),
|
|
@@ -175567,7 +175597,7 @@ function appendBarText(gd, plotinfo, bar, cd, i, x0, x1, y0, y1, opts, makeOnCom
|
|
|
175567
175597
|
}
|
|
175568
175598
|
|
|
175569
175599
|
transform.fontSize = font.size;
|
|
175570
|
-
recordMinTextSize(trace.type, transform, fullLayout);
|
|
175600
|
+
recordMinTextSize(trace.type === 'histogram' ? 'bar' : trace.type, transform, fullLayout);
|
|
175571
175601
|
calcBar.transform = transform;
|
|
175572
175602
|
|
|
175573
175603
|
transition(textSelection, fullLayout, opts, makeOnCompleteCallback)
|
|
@@ -190823,6 +190853,8 @@ module.exports = {
|
|
|
190823
190853
|
var barAttrs = _dereq_('../bar/attributes');
|
|
190824
190854
|
var axisHoverFormat = _dereq_('../../plots/cartesian/axis_format_attributes').axisHoverFormat;
|
|
190825
190855
|
var hovertemplateAttrs = _dereq_('../../plots/template_attributes').hovertemplateAttrs;
|
|
190856
|
+
var texttemplateAttrs = _dereq_('../../plots/template_attributes').texttemplateAttrs;
|
|
190857
|
+
var fontAttrs = _dereq_('../../plots/font_attributes');
|
|
190826
190858
|
var makeBinAttrs = _dereq_('./bin_attributes');
|
|
190827
190859
|
var constants = _dereq_('./constants');
|
|
190828
190860
|
var extendFlat = _dereq_('../../lib/extend').extendFlat;
|
|
@@ -191018,6 +191050,44 @@ module.exports = {
|
|
|
191018
191050
|
keys: constants.eventDataKeys
|
|
191019
191051
|
}),
|
|
191020
191052
|
|
|
191053
|
+
texttemplate: texttemplateAttrs({
|
|
191054
|
+
arrayOk: false,
|
|
191055
|
+
editType: 'plot'
|
|
191056
|
+
}, {
|
|
191057
|
+
keys: ['label', 'value']
|
|
191058
|
+
}),
|
|
191059
|
+
|
|
191060
|
+
textposition: extendFlat({}, barAttrs.textposition, {
|
|
191061
|
+
arrayOk: false
|
|
191062
|
+
}),
|
|
191063
|
+
|
|
191064
|
+
textfont: fontAttrs({
|
|
191065
|
+
arrayOk: false,
|
|
191066
|
+
editType: 'plot',
|
|
191067
|
+
colorEditType: 'style',
|
|
191068
|
+
description: 'Sets the text font.'
|
|
191069
|
+
}),
|
|
191070
|
+
|
|
191071
|
+
outsidetextfont: fontAttrs({
|
|
191072
|
+
arrayOk: false,
|
|
191073
|
+
editType: 'plot',
|
|
191074
|
+
colorEditType: 'style',
|
|
191075
|
+
description: 'Sets the font used for `text` lying outside the bar.'
|
|
191076
|
+
}),
|
|
191077
|
+
|
|
191078
|
+
insidetextfont: fontAttrs({
|
|
191079
|
+
arrayOk: false,
|
|
191080
|
+
editType: 'plot',
|
|
191081
|
+
colorEditType: 'style',
|
|
191082
|
+
description: 'Sets the font used for `text` lying inside the bar.'
|
|
191083
|
+
}),
|
|
191084
|
+
|
|
191085
|
+
insidetextanchor: barAttrs.insidetextanchor,
|
|
191086
|
+
|
|
191087
|
+
textangle: barAttrs.textangle,
|
|
191088
|
+
cliponaxis: barAttrs.cliponaxis,
|
|
191089
|
+
constraintext: barAttrs.constraintext,
|
|
191090
|
+
|
|
191021
191091
|
marker: barAttrs.marker,
|
|
191022
191092
|
|
|
191023
191093
|
offsetgroup: barAttrs.offsetgroup,
|
|
@@ -191031,7 +191101,7 @@ module.exports = {
|
|
|
191031
191101
|
}
|
|
191032
191102
|
};
|
|
191033
191103
|
|
|
191034
|
-
},{"../../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){
|
|
191104
|
+
},{"../../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){
|
|
191035
191105
|
'use strict';
|
|
191036
191106
|
|
|
191037
191107
|
|
|
@@ -192198,6 +192268,7 @@ var Registry = _dereq_('../../registry');
|
|
|
192198
192268
|
var Lib = _dereq_('../../lib');
|
|
192199
192269
|
var Color = _dereq_('../../components/color');
|
|
192200
192270
|
|
|
192271
|
+
var handleText = _dereq_('../bar/defaults').handleText;
|
|
192201
192272
|
var handleStyleDefaults = _dereq_('../bar/style_defaults');
|
|
192202
192273
|
var attributes = _dereq_('./attributes');
|
|
192203
192274
|
|
|
@@ -192216,6 +192287,16 @@ module.exports = function supplyDefaults(traceIn, traceOut, defaultColor, layout
|
|
|
192216
192287
|
}
|
|
192217
192288
|
|
|
192218
192289
|
coerce('text');
|
|
192290
|
+
var textposition = coerce('textposition');
|
|
192291
|
+
handleText(traceIn, traceOut, layout, coerce, textposition, {
|
|
192292
|
+
moduleHasSelected: true,
|
|
192293
|
+
moduleHasUnselected: true,
|
|
192294
|
+
moduleHasConstrain: true,
|
|
192295
|
+
moduleHasCliponaxis: true,
|
|
192296
|
+
moduleHasTextangle: true,
|
|
192297
|
+
moduleHasInsideanchor: true
|
|
192298
|
+
});
|
|
192299
|
+
|
|
192219
192300
|
coerce('hovertext');
|
|
192220
192301
|
coerce('hovertemplate');
|
|
192221
192302
|
coerce('xhoverformat');
|
|
@@ -192259,7 +192340,7 @@ module.exports = function supplyDefaults(traceIn, traceOut, defaultColor, layout
|
|
|
192259
192340
|
errorBarsSupplyDefaults(traceIn, traceOut, lineColor || Color.defaultLine, {axis: 'x', inherit: 'y'});
|
|
192260
192341
|
};
|
|
192261
192342
|
|
|
192262
|
-
},{"../../components/color":366,"../../lib":503,"../../registry":638,"../bar/style_defaults":663,"./attributes":811}],820:[function(_dereq_,module,exports){
|
|
192343
|
+
},{"../../components/color":366,"../../lib":503,"../../registry":638,"../bar/defaults":652,"../bar/style_defaults":663,"./attributes":811}],820:[function(_dereq_,module,exports){
|
|
192263
192344
|
'use strict';
|
|
192264
192345
|
|
|
192265
192346
|
module.exports = function eventData(out, pt, trace, cd, pointNumber) {
|
|
@@ -229834,7 +229915,7 @@ function getSortFunc(opts, d2c) {
|
|
|
229834
229915
|
'use strict';
|
|
229835
229916
|
|
|
229836
229917
|
// package version injected by `npm run preprocess`
|
|
229837
|
-
exports.version = '2.
|
|
229918
|
+
exports.version = '2.7.0';
|
|
229838
229919
|
|
|
229839
229920
|
},{}],1119:[function(_dereq_,module,exports){
|
|
229840
229921
|
(function (global){(function (){
|