1
1
/**
2
- * plotly.js v1.10.1
2
+ * plotly.js v1.10.2
3
3
* Copyright 2012-2016, Plotly, Inc.
4
4
* All rights reserved.
5
5
* Licensed under the MIT license
@@ -51023,7 +51023,7 @@ annotations.draw = function(gd, index, opt, value) {
51023
51023
51024
51024
var annX = Math.round(annPosPx.x - outerwidth / 2),
51025
51025
annY = Math.round(annPosPx.y - outerheight / 2);
51026
- ann.attr('transform', 'translate(' + annX + ', ' + annY + ')' );
51026
+ ann.call(Lib.setTranslate, annX, annY);
51027
51027
51028
51028
var annbase = 'annotations['+index+']';
51029
51029
@@ -51116,8 +51116,10 @@ annotations.draw = function(gd, index, opt, value) {
51116
51116
dragElement.init({
51117
51117
element: arrowdrag.node(),
51118
51118
prepFn: function() {
51119
- annx0 = Number(ann.attr('x'));
51120
- anny0 = Number(ann.attr('y'));
51119
+ var pos = Lib.getTranslate(ann);
51120
+
51121
+ annx0 = pos.x;
51122
+ anny0 = pos.y;
51121
51123
update = {};
51122
51124
if(xa && xa.autorange) {
51123
51125
update[xa._name+'.autorange'] = true;
@@ -51132,7 +51134,7 @@ annotations.draw = function(gd, index, opt, value) {
51132
51134
var annxy0 = applyTransform(annx0, anny0),
51133
51135
xcenter = annxy0[0] + dx,
51134
51136
ycenter = annxy0[1] + dy;
51135
- ann.call(Drawing.setPosition , xcenter, ycenter);
51137
+ ann.call(Lib.setTranslate , xcenter, ycenter);
51136
51138
51137
51139
update[annbase+'.x'] = xa ?
51138
51140
(options.x + dx / xa._m) :
@@ -51173,12 +51175,14 @@ annotations.draw = function(gd, index, opt, value) {
51173
51175
dragElement.init({
51174
51176
element: ann.node(),
51175
51177
prepFn: function() {
51176
- x0 = Number(ann.attr('x'));
51177
- y0 = Number(ann.attr('y'));
51178
+ var pos = Lib.getTranslate(ann);
51179
+
51180
+ x0 = pos.x;
51181
+ y0 = pos.y;
51178
51182
update = {};
51179
51183
},
51180
51184
moveFn: function(dx, dy) {
51181
- ann.call(Drawing.setPosition , x0 + dx, y0 + dy);
51185
+ ann.call(Lib.setTranslate , x0 + dx, y0 + dy);
51182
51186
var csr = 'pointer';
51183
51187
if(options.showarrow) {
51184
51188
update[annbase+'.ax'] = options.ax + dx;
@@ -51204,7 +51208,7 @@ annotations.draw = function(gd, index, opt, value) {
51204
51208
heightFraction, 0, 1, options.yanchor);
51205
51209
}
51206
51210
if(!xa || !ya) {
51207
- csr = dragElement.cursor (
51211
+ csr = dragElement.getCursor (
51208
51212
xa ? 0.5 : update[annbase + '.x'],
51209
51213
ya ? 0.5 : update[annbase + '.y'],
51210
51214
options.xanchor, options.yanchor
@@ -51216,7 +51220,7 @@ annotations.draw = function(gd, index, opt, value) {
51216
51220
x1 = xy1[0] + dx,
51217
51221
y1 = xy1[1] + dy;
51218
51222
51219
- ann.call(Drawing.setPosition, x1, y1 );
51223
+ ann.call(Lib.setTranslate, x0 + dx, y0 + dy );
51220
51224
51221
51225
anng.attr({
51222
51226
transform: 'rotate(' + textangle + ',' +
@@ -58424,6 +58428,8 @@ function draw(gd) {
58424
58428
58425
58429
'use strict';
58426
58430
58431
+ var d3 = require('d3');
58432
+
58427
58433
var Symbols = require('../drawing/symbol_defs');
58428
58434
var Drawing = require('../drawing');
58429
58435
@@ -58454,7 +58460,7 @@ module.exports = function rangePlot(gd, w, h) {
58454
58460
clipDefs.appendChild(clip);
58455
58461
58456
58462
var rangePlot = document.createElementNS(svgNS, 'g');
58457
- rangePlot.setAttribute('clip-path' , 'url(# range-clip-path) ');
58463
+ d3.select( rangePlot).call(Drawing.setClipUrl , 'range-clip-path');
58458
58464
rangePlot.appendChild(clipDefs);
58459
58465
58460
58466
@@ -58591,7 +58597,7 @@ function makeScatter(trace, pointPairs, w, h) {
58591
58597
return [line, markers, fill];
58592
58598
}
58593
58599
58594
- },{"../../constants/xmlns_namespaces":366,"../drawing":325,"../drawing/symbol_defs":326,"./helpers":356}],359:[function(require,module,exports){
58600
+ },{"../../constants/xmlns_namespaces":366,"../drawing":325,"../drawing/symbol_defs":326,"./helpers":356,"d3":72 }],359:[function(require,module,exports){
58595
58601
/**
58596
58602
* Copyright 2012-2016, Plotly, Inc.
58597
58603
* All rights reserved.
@@ -58647,7 +58653,11 @@ module.exports = {
58647
58653
'refers to an x coordinate',
58648
58654
'If set to *paper*, the `x` position refers to the distance from',
58649
58655
'the left side of the plotting area in normalized coordinates',
58650
- 'where *0* (*1*) corresponds to the left (right) side.'
58656
+ 'where *0* (*1*) corresponds to the left (right) side.',
58657
+ 'If the axis `type` is *log*, then you must take the',
58658
+ 'log of your desired range.',
58659
+ 'If the axis `type` is *date*, then you must convert',
58660
+ 'the date to unix time in milliseconds.'
58651
58661
].join(' ')
58652
58662
}),
58653
58663
x0: {
@@ -58873,17 +58883,17 @@ shapes.add = function(gd) {
58873
58883
// if opt is blank, val can be 'add' or a full options object to add a new
58874
58884
// annotation at that point in the array, or 'remove' to delete this one
58875
58885
shapes.draw = function(gd, index, opt, value) {
58876
- if(!isNumeric(index) || index===-1) {
58886
+ if(!isNumeric(index) || index === -1) {
58877
58887
// no index provided - we're operating on ALL shapes
58878
58888
if(!index && Array.isArray(value)) {
58879
58889
replaceAllShapes(gd, value);
58880
58890
return;
58881
58891
}
58882
- else if(value==='remove') {
58892
+ else if(value === 'remove') {
58883
58893
deleteAllShapes(gd);
58884
58894
return;
58885
58895
}
58886
- else if(opt && value!=='add') {
58896
+ else if(opt && value !== 'add') {
58887
58897
updateAllShapes(gd, opt, value);
58888
58898
return;
58889
58899
}
@@ -58895,11 +58905,11 @@ shapes.draw = function(gd, index, opt, value) {
58895
58905
}
58896
58906
58897
58907
if(!opt && value) {
58898
- if(value==='remove') {
58908
+ if(value === 'remove') {
58899
58909
deleteShape(gd, index);
58900
58910
return;
58901
58911
}
58902
- else if(value==='add' || Lib.isPlainObject(value)) {
58912
+ else if(value === 'add' || Lib.isPlainObject(value)) {
58903
58913
insertShape(gd, index, value);
58904
58914
}
58905
58915
}
@@ -59799,7 +59809,7 @@ exports.svgAttrs = {
59799
59809
var Plotly = require('./plotly');
59800
59810
59801
59811
// package version injected by `npm run preprocess`
59802
- exports.version = '1.10.1 ';
59812
+ exports.version = '1.10.2 ';
59803
59813
59804
59814
// plot api
59805
59815
exports.plot = Plotly.plot;
@@ -65391,6 +65401,12 @@ Plotly.relayout = function relayout(gd, astr, val) {
65391
65401
else if(/[xy]axis[0-9]*?$/.test(pleaf) && !Object.keys(vi || {}).length) {
65392
65402
docalc = true;
65393
65403
}
65404
+ else if(/[xy]axis[0-9]*\.categoryorder$/.test(pleafPlus)) {
65405
+ docalc = true;
65406
+ }
65407
+ else if(/[xy]axis[0-9]*\.categoryarray/.test(pleafPlus)) {
65408
+ docalc = true;
65409
+ }
65394
65410
65395
65411
if(pleafPlus.indexOf('rangeslider') !== -1) {
65396
65412
docalc = true;
@@ -65822,8 +65838,10 @@ function makePlotFramework(gd) {
65822
65838
65823
65839
// lower shape layer
65824
65840
// (only for shapes to be drawn below the whole plot)
65825
- fullLayout._shapeLowerLayer = fullLayout._paper.append('g')
65826
- .classed('shapelayer shapelayer-below', true);
65841
+ var layerBelow = fullLayout._paper.append('g')
65842
+ .classed('layer-below', true);
65843
+ fullLayout._shapeLowerLayer = layerBelow.append('g')
65844
+ .classed('shapelayer', true);
65827
65845
65828
65846
var subplots = Plotly.Axes.getSubplots(gd);
65829
65847
if(subplots.join('') !== Object.keys(gd._fullLayout._plots || {}).join('')) {
@@ -65841,8 +65859,10 @@ function makePlotFramework(gd) {
65841
65859
65842
65860
// upper shape layer
65843
65861
// (only for shapes to be drawn above the whole plot, including subplots)
65844
- fullLayout._shapeUpperLayer = fullLayout._paper.append('g')
65845
- .classed('shapelayer shapelayer-above', true);
65862
+ var layerAbove = fullLayout._paper.append('g')
65863
+ .classed('layer-above', true);
65864
+ fullLayout._shapeUpperLayer = layerAbove.append('g')
65865
+ .classed('shapelayer', true);
65846
65866
65847
65867
// single pie layer for the whole plot
65848
65868
fullLayout._pielayer = fullLayout._paper.append('g').classed('pielayer', true);
@@ -66089,10 +66109,8 @@ function lsInner(gd) {
66089
66109
});
66090
66110
66091
66111
66092
- plotinfo.plot.attr({
66093
- 'transform': 'translate(' + xa._offset + ', ' + ya._offset + ')',
66094
- 'clip-path': 'url(#' + clipId + ')'
66095
- });
66112
+ plotinfo.plot.call(Lib.setTranslate, xa._offset, ya._offset);
66113
+ plotinfo.plot.call(Drawing.setClipUrl, clipId);
66096
66114
66097
66115
var xlw = Drawing.crispRound(gd, xa.linewidth, 1),
66098
66116
ylw = Drawing.crispRound(gd, ya.linewidth, 1),
@@ -68987,10 +69005,6 @@ module.exports = function handleAxisDefaults(containerIn, containerOut, coerce,
68987
69005
}
68988
69006
}
68989
69007
68990
- containerOut._initialCategories = axType === 'category' ?
68991
- orderedCategories(letter, containerIn.categoryorder, containerIn.categoryarray, options.data) :
68992
- [];
68993
-
68994
69008
setConvert(containerOut);
68995
69009
68996
69010
var dfltColor = coerce('color');
@@ -69055,13 +69069,18 @@ module.exports = function handleAxisDefaults(containerIn, containerOut, coerce,
69055
69069
delete containerOut.zerolinewidth;
69056
69070
}
69057
69071
69072
+ // fill in categories
69073
+ containerOut._initialCategories = axType === 'category' ?
69074
+ orderedCategories(letter, containerOut.categoryorder, containerOut.categoryarray, options.data) :
69075
+ [];
69076
+
69058
69077
return containerOut;
69059
69078
};
69060
69079
69061
69080
function setAutoType(ax, data) {
69062
69081
// new logic: let people specify any type they want,
69063
69082
// only autotype if type is '-'
69064
- if(ax.type!=='-') return;
69083
+ if(ax.type !== '-') return;
69065
69084
69066
69085
var id = ax._id,
69067
69086
axLetter = id.charAt(0);
@@ -69076,7 +69095,7 @@ function setAutoType(ax, data) {
69076
69095
// should always default to a linear axis
69077
69096
if(d0.type==='histogram' &&
69078
69097
axLetter === {v: 'y', h: 'x'}[d0.orientation || 'v']) {
69079
- ax.type= 'linear';
69098
+ ax.type = 'linear';
69080
69099
return;
69081
69100
}
69082
69101
@@ -69324,37 +69343,30 @@ exports.getFromTrace = function(gd, fullTrace, type) {
69324
69343
69325
69344
'use strict';
69326
69345
69327
- var layoutAttributes = require('./layout_attributes');
69328
69346
69329
69347
module.exports = function handleCategoryOrderDefaults(containerIn, containerOut, coerce) {
69348
+ if(containerOut.type !== 'category') return;
69330
69349
69331
- if(containerIn.type !== 'category') return;
69332
-
69333
- var validCategories = layoutAttributes.categoryorder.values;
69334
-
69335
- var propercategoryarray = Array.isArray(containerIn.categoryarray) && containerIn.categoryarray.length > 0;
69336
-
69337
- if(validCategories.indexOf(containerIn.categoryorder) === -1 && propercategoryarray) {
69350
+ var arrayIn = containerIn.categoryarray,
69351
+ orderDefault;
69338
69352
69339
- // when unspecified or invalid, use the default, unless categoryarray implies 'array'
69340
- coerce('categoryorder', 'array'); // promote to 'array'
69353
+ var isValidArray = (Array.isArray(arrayIn) && arrayIn.length > 0);
69341
69354
69342
- } else if(containerIn.categoryorder === 'array' && !propercategoryarray) {
69355
+ // override default 'categoryorder' value when non-empty array is supplied
69356
+ if(isValidArray) orderDefault = 'array';
69343
69357
69344
- // when mode is 'array' but no list is given, revert to default
69345
-
69346
- containerIn.categoryorder = 'trace'; // revert to default
69347
- coerce('categoryorder');
69348
-
69349
- } else {
69358
+ var order = coerce('categoryorder', orderDefault);
69350
69359
69351
- // otherwise use the supplied mode, or the default one if unsupplied or invalid
69352
- coerce('categoryorder ');
69360
+ // coerce 'categoryarray' only in array order case
69361
+ if(order === 'array') coerce('categoryarray ');
69353
69362
69363
+ // cannot set 'categoryorder' to 'array' with an invalid 'categoryarray'
69364
+ if(!isValidArray && order === 'array') {
69365
+ containerOut.categoryorder = 'trace';
69354
69366
}
69355
69367
};
69356
69368
69357
- },{"./layout_attributes":408 }],403:[function(require,module,exports){
69369
+ },{}],403:[function(require,module,exports){
69358
69370
/**
69359
69371
* Copyright 2012-2016, Plotly, Inc.
69360
69372
* All rights reserved.
0 commit comments