Skip to content

Commit ccbcb58

Browse files
committed
Merge branch 'master' into transform-plugins
2 parents f93b9c1 + 7ae437b commit ccbcb58

Some content is hidden

Large Commits have some content hidden by default. Use the searchbox below for content that may be hidden.

46 files changed

+2246
-461
lines changed

CHANGELOG.md

+15
Original file line numberDiff line numberDiff line change
@@ -10,6 +10,21 @@ https://github.com/plotly/plotly.js/compare/vX.Y.Z...master
1010
where X.Y.Z is the semver of most recent plotly.js release.
1111

1212

13+
## [1.14.2] -- 2016-07-11
14+
15+
### Fixed
16+
- `Plotly.newPlot` correctly clears all present WebGL contexts [#724]
17+
- Bar traces with `layout.bargap` 0 and unset `marker.line.width` are functional
18+
again (bug introduced in 1.3.0) [#709]
19+
- Stacked bar traces now correctly set the first bar position when leading gaps
20+
are present (bug introduced in 1.11.0) [#716]
21+
- Bar traces with `layout.barmode` relative now correctly compute the bar sum of
22+
the first position when positive and negative values are present [#723]
23+
- Event `plotly_relayout` is emitted upon pan / zoom on a mapbox subplot [#727]
24+
- Lasso and select box drag modes now work with fixed ranged axes [#728]
25+
- gl2d trace objects are purged when their parent scenes are destroyed [#724]
26+
27+
1328
## [1.14.1] -- 2016-06-28
1429

1530
### Fixed

dist/plotly-geo-assets.js

+2-2
Some generated files are not rendered by default. Learn more about customizing how changed files appear on GitHub.

dist/plotly-with-meta.js

+84-56
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,5 @@
11
/**
2-
* plotly.js v1.14.1
2+
* plotly.js v1.14.2
33
* Copyright 2012-2016, Plotly, Inc.
44
* All rights reserved.
55
* Licensed under the MIT license
@@ -57082,7 +57082,6 @@ function stylePies(d) {
5708257082

5708357083
var Plotly = require('../../plotly');
5708457084
var Lib = require('../../lib');
57085-
var setCursor = require('../../lib/setcursor');
5708657085
var downloadImage = require('../../snapshot/download');
5708757086
var Icons = require('../../../build/ploticon');
5708857087

@@ -57242,13 +57241,6 @@ modeBarButtons.hoverCompareCartesian = {
5724257241
click: handleCartesian
5724357242
};
5724457243

57245-
var DRAGCURSORS = {
57246-
pan: 'move',
57247-
zoom: 'crosshair',
57248-
select: 'crosshair',
57249-
lasso: 'crosshair'
57250-
};
57251-
5725257244
function handleCartesian(gd, ev) {
5725357245
var button = ev.currentTarget,
5725457246
astr = button.getAttribute('data-attr'),
@@ -57298,18 +57290,7 @@ function handleCartesian(gd, ev) {
5729857290
aobj[astr] = val;
5729957291
}
5730057292

57301-
Plotly.relayout(gd, aobj).then(function() {
57302-
if(astr === 'dragmode') {
57303-
if(fullLayout._has('cartesian')) {
57304-
setCursor(
57305-
fullLayout._paper.select('.nsewdrag'),
57306-
DRAGCURSORS[val]
57307-
);
57308-
}
57309-
Plotly.Fx.supplyLayoutDefaults(gd.layout, fullLayout, gd._fullData);
57310-
Plotly.Fx.init(gd);
57311-
}
57312-
});
57293+
Plotly.relayout(gd, aobj);
5731357294
}
5731457295

5731557296
modeBarButtons.zoom3d = {
@@ -57595,7 +57576,7 @@ modeBarButtons.resetViews = {
5759557576
}
5759657577
};
5759757578

57598-
},{"../../../build/ploticon":2,"../../lib":382,"../../lib/setcursor":391,"../../plotly":402,"../../snapshot/download":469}],349:[function(require,module,exports){
57579+
},{"../../../build/ploticon":2,"../../lib":382,"../../plotly":402,"../../snapshot/download":469}],349:[function(require,module,exports){
5759957580
/**
5760057581
* Copyright 2012-2016, Plotly, Inc.
5760157582
* All rights reserved.
@@ -60704,7 +60685,7 @@ exports.svgAttrs = {
6070460685
var Plotly = require('./plotly');
6070560686

6070660687
// package version injected by `npm run preprocess`
60707-
exports.version = '1.14.1';
60688+
exports.version = '1.14.2';
6070860689

6070960690
// plot api
6071060691
exports.plot = Plotly.plot;
@@ -65110,6 +65091,10 @@ Plotly.redraw = function(gd) {
6511065091
*/
6511165092
Plotly.newPlot = function(gd, data, layout, config) {
6511265093
gd = getGraphDiv(gd);
65094+
65095+
// remove gl contexts
65096+
Plots.cleanPlot([], {}, gd._fullData || {}, gd._fullLayout || {});
65097+
6511365098
Plots.purge(gd);
6511465099
return Plotly.plot(gd, data, layout, config);
6511565100
};
@@ -66700,6 +66685,9 @@ Plotly.relayout = function relayout(gd, astr, val) {
6670066685
var subplotIds;
6670166686
manageModeBar(gd);
6670266687

66688+
Plotly.Fx.supplyLayoutDefaults(gd.layout, fullLayout, gd._fullData);
66689+
Plotly.Fx.init(gd);
66690+
6670366691
subplotIds = Plots.getSubplotIds(fullLayout, 'gl3d');
6670466692
for(i = 0; i < subplotIds.length; i++) {
6670566693
scene = fullLayout[subplotIds[i]]._scene;
@@ -70768,7 +70756,8 @@ module.exports = function dragBox(gd, plotinfo, x, y, w, h, ns, ew) {
7076870756
pw = xa[0]._length,
7076970757
ph = ya[0]._length,
7077070758
MINDRAG = constants.MINDRAG,
70771-
MINZOOM = constants.MINZOOM;
70759+
MINZOOM = constants.MINZOOM,
70760+
isMainDrag = (ns + ew === 'nsew');
7077270761

7077370762
for(var i = 1; i < subplots.length; i++) {
7077470763
var subplotXa = subplots[i].x(),
@@ -70791,21 +70780,24 @@ module.exports = function dragBox(gd, plotinfo, x, y, w, h, ns, ew) {
7079170780
dragClass = ns + ew + 'drag';
7079270781

7079370782
var dragger3 = plotinfo.draglayer.selectAll('.' + dragClass).data([0]);
70783+
7079470784
dragger3.enter().append('rect')
7079570785
.classed('drag', true)
7079670786
.classed(dragClass, true)
7079770787
.style({fill: 'transparent', 'stroke-width': 0})
7079870788
.attr('data-subplot', plotinfo.id);
70789+
7079970790
dragger3.call(Drawing.setRect, x, y, w, h)
7080070791
.call(setCursor, cursor);
70792+
7080170793
var dragger = dragger3.node();
7080270794

7080370795
// still need to make the element if the axes are disabled
7080470796
// but nuke its events (except for maindrag which needs them for hover)
7080570797
// and stop there
70806-
if(!yActive && !xActive) {
70798+
if(!yActive && !xActive && !isSelectOrLasso(fullLayout.dragmode)) {
7080770799
dragger.onmousedown = null;
70808-
dragger.style.pointerEvents = (ns + ew === 'nsew') ? 'all' : 'none';
70800+
dragger.style.pointerEvents = isMainDrag ? 'all' : 'none';
7080970801
return dragger;
7081070802
}
7081170803

@@ -70823,7 +70815,8 @@ module.exports = function dragBox(gd, plotinfo, x, y, w, h, ns, ew) {
7082370815
doubleclick: doubleClick,
7082470816
prepFn: function(e, startX, startY) {
7082570817
var dragModeNow = gd._fullLayout.dragmode;
70826-
if(ns + ew === 'nsew') {
70818+
70819+
if(isMainDrag) {
7082770820
// main dragger handles all drag modes, and changes
7082870821
// to pan (or to zoom if it already is pan) on shift
7082970822
if(e.shiftKey) {
@@ -70847,7 +70840,7 @@ module.exports = function dragBox(gd, plotinfo, x, y, w, h, ns, ew) {
7084770840
dragOptions.doneFn = dragDone;
7084870841
clearSelect();
7084970842
}
70850-
else if(dragModeNow === 'select' || dragModeNow === 'lasso') {
70843+
else if(isSelectOrLasso(dragModeNow)) {
7085170844
prepSelect(e, startX, startY, dragOptions, dragModeNow);
7085270845
}
7085370846
}
@@ -71385,6 +71378,12 @@ function removeZoombox(gd) {
7138571378
.remove();
7138671379
}
7138771380

71381+
function isSelectOrLasso(dragmode) {
71382+
var modes = ['lasso', 'select'];
71383+
71384+
return modes.indexOf(dragmode) !== -1;
71385+
}
71386+
7138871387
},{"../../components/color":303,"../../components/dragelement":324,"../../components/drawing":326,"../../lib":382,"../../lib/setcursor":391,"../../lib/svg_text_utils":395,"../../plotly":402,"./axes":405,"./constants":410,"./select":418,"d3":113,"tinycolor2":274}],412:[function(require,module,exports){
7138971388
/**
7139071389
* Copyright 2012-2016, Plotly, Inc.
@@ -77478,6 +77477,16 @@ proto.cameraChanged = function() {
7747877477
};
7747977478

7748077479
proto.destroy = function() {
77480+
77481+
var traces = this.traces;
77482+
77483+
if(traces) {
77484+
Object.keys(traces).map(function(key) {
77485+
traces[key].dispose();
77486+
delete traces[key];
77487+
});
77488+
}
77489+
7748177490
this.glplot.dispose();
7748277491

7748377492
if(!this.staticPlot) this.container.removeChild(this.canvas);
@@ -84539,6 +84548,19 @@ var extendFlat = require('../../lib/extend').extendFlat;
8453984548
var scatterMarkerAttrs = scatterAttrs.marker;
8454084549
var scatterMarkerLineAttrs = scatterMarkerAttrs.line;
8454184550

84551+
var markerLineWidth = extendFlat({},
84552+
scatterMarkerLineAttrs.width, { dflt: 0 });
84553+
84554+
var markerLine = extendFlat({}, {
84555+
width: markerLineWidth
84556+
}, colorAttributes('marker.line'));
84557+
84558+
var marker = extendFlat({}, {
84559+
showscale: scatterMarkerAttrs.showscale,
84560+
line: markerLine
84561+
}, colorAttributes('marker'));
84562+
84563+
8454284564
module.exports = {
8454384565
x: scatterAttrs.x,
8454484566
x0: scatterAttrs.x0,
@@ -84547,6 +84569,7 @@ module.exports = {
8454784569
y0: scatterAttrs.y0,
8454884570
dy: scatterAttrs.dy,
8454984571
text: scatterAttrs.text,
84572+
8455084573
orientation: {
8455184574
valType: 'enumerated',
8455284575
role: 'info',
@@ -84557,14 +84580,8 @@ module.exports = {
8455784580
'along the vertical (horizontal).'
8455884581
].join(' ')
8455984582
},
84560-
marker: extendFlat({}, {
84561-
showscale: scatterMarkerAttrs.showscale,
84562-
line: extendFlat({},
84563-
{width: scatterMarkerLineAttrs.width},
84564-
colorAttributes('marker.line')
84565-
)},
84566-
colorAttributes('marker')
84567-
),
84583+
84584+
marker: marker,
8456884585

8456984586
r: scatterAttrs.r,
8457084587
t: scatterAttrs.t,
@@ -84627,7 +84644,13 @@ module.exports = function calc(gd, trace) {
8462784644
// create the "calculated data" to plot
8462884645
var serieslen = Math.min(pos.length, size.length),
8462984646
cd = [];
84647+
8463084648
for(i = 0; i < serieslen; i++) {
84649+
84650+
// add bars with non-numeric sizes to calcdata
84651+
// so that ensure that traces with gaps are
84652+
// plotted in the correct order
84653+
8463184654
if(isNumeric(pos[i])) {
8463284655
cd.push({p: pos[i], s: size[i], b: 0});
8463384656
}
@@ -85198,9 +85221,17 @@ module.exports = function setPositions(gd, plotinfo) {
8519885221
for(i = 0; i < bl.length; i++) { // trace index
8519985222
ti = gd.calcdata[bl[i]];
8520085223
for(j = 0; j < ti.length; j++) {
85224+
85225+
// skip over bars with no size,
85226+
// so that we don't try to stack them
85227+
if(!isNumeric(ti[j].s)) continue;
85228+
8520185229
sv = Math.round(ti[j].p / sumround);
85202-
// store the negative sum value for p at the same key, with sign flipped
85203-
if(relative && ti[j].s < 0) sv = -sv;
85230+
85231+
// store the negative sum value for p at the same key,
85232+
// with sign flipped using string to ensure -0 !== 0.
85233+
if(relative && ti[j].s < 0) sv = '-' + sv;
85234+
8520485235
var previousSum = sums[sv] || 0;
8520585236
if(stack || relative) ti[j].b = previousSum;
8520685237
barEnd = ti[j].b + ti[j].s;
@@ -85218,20 +85249,29 @@ module.exports = function setPositions(gd, plotinfo) {
8521885249
}
8521985250

8522085251
if(norm) {
85221-
padded = false;
8522285252
var top = norm === 'fraction' ? 1 : 100,
8522385253
relAndNegative = false,
8522485254
tiny = top / 1e9; // in case of rounding error in sum
85255+
85256+
padded = false;
8522585257
sMin = 0;
8522685258
sMax = stack ? top : 0;
85259+
8522785260
for(i = 0; i < bl.length; i++) { // trace index
8522885261
ti = gd.calcdata[bl[i]];
85262+
8522985263
for(j = 0; j < ti.length; j++) {
85230-
relAndNegative = relative && ti[j].s < 0;
85264+
relAndNegative = (relative && ti[j].s < 0);
85265+
8523185266
sv = Math.round(ti[j].p / sumround);
85232-
if(relAndNegative) sv = -sv; // locate negative sum amount for this p val
85267+
85268+
// locate negative sum amount for this p val
85269+
if(relAndNegative) sv = '-' + sv;
85270+
8523385271
scale = top / sums[sv];
85234-
if(relAndNegative) scale *= -1; // preserve sign if negative
85272+
85273+
// preserve sign if negative
85274+
if(relAndNegative) scale *= -1;
8523585275
ti[j].b *= scale;
8523685276
ti[j].s *= scale;
8523785277
barEnd = ti[j].b + ti[j].s;
@@ -89393,12 +89433,7 @@ function isValidZ(z) {
8939389433
'use strict';
8939489434

8939589435
var barAttrs = require('../bar/attributes');
89396-
var colorAttributes = require('../../components/colorscale/color_attributes');
8939789436

89398-
var extendFlat = require('../../lib/extend').extendDeep;
89399-
89400-
var barMarkerAttrs = barAttrs.marker;
89401-
var barMarkerLineAttrs = barMarkerAttrs.line;
8940289437

8940389438
module.exports = {
8940489439
x: {
@@ -89508,14 +89543,7 @@ module.exports = {
8950889543
},
8950989544
ybins: makeBinsAttr('y'),
8951089545

89511-
marker: extendFlat({}, {
89512-
showscale: barMarkerAttrs.showscale,
89513-
line: extendFlat({},
89514-
{width: extendFlat({}, barMarkerLineAttrs.width, {dflt: 0})},
89515-
colorAttributes('marker.line'))
89516-
},
89517-
colorAttributes('marker')
89518-
),
89546+
marker: barAttrs.marker,
8951989547

8952089548
_nestedModules: {
8952189549
'error_y': 'ErrorBars',
@@ -89560,7 +89588,7 @@ function makeBinsAttr(axLetter) {
8956089588
};
8956189589
}
8956289590

89563-
},{"../../components/colorscale/color_attributes":311,"../../lib/extend":377,"../bar/attributes":476}],525:[function(require,module,exports){
89591+
},{"../bar/attributes":476}],525:[function(require,module,exports){
8956489592
/**
8956589593
* Copyright 2012-2016, Plotly, Inc.
8956689594
* All rights reserved.

0 commit comments

Comments
 (0)