Skip to content

Commit edaf8fe

Browse files
committed
Merge branch 'merge-animate-api-take-3' into animate-api-take-3
2 parents f50c295 + fb04b65 commit edaf8fe

29 files changed

+339
-144
lines changed

CHANGELOG.md

+14
Original file line numberDiff line numberDiff line change
@@ -10,6 +10,20 @@ 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.1] -- 2016-06-28
14+
15+
### Fixed
16+
- Fix colorscale restyle calls on heatmap traces (bug introduced in 1.14.0)
17+
[#694]
18+
- Hover after zoom / pan is now functional again in ternary plots (bug
19+
introduced in 1.14.0) [#688]
20+
- Fix mapbox layer relayout starting from invisible layer [#693]
21+
- Hover labels when `hoveron: 'fills'` are now constrained to the viewports
22+
[#688]
23+
- Fix `surface` countours description [#696]
24+
- Fix `mapbox.layers.line` description [#690]
25+
26+
1327
## [1.14.0] -- 2016-06-22
1428

1529
### Added

README.md

-3
Original file line numberDiff line numberDiff line change
@@ -1,10 +1,7 @@
11
<a href="https://plot.ly/javascript/"><img src="http://images.plot.ly/logo/[email protected]" height="70"></a>
22

33
[![npm version](https://badge.fury.io/js/plotly.js.svg)](https://badge.fury.io/js/plotly.js)
4-
54
[![circle ci](https://circleci.com/gh/plotly/plotly.js.png?&style=shield&circle-token=1f42a03b242bd969756fc3e53ede204af9b507c0)](https://circleci.com/gh/plotly/plotly.js)
6-
[![Dependency Status](https://david-dm.org/plotly/plotly.js.svg?style=flat-square)](https://david-dm.org/plotly/plotly.js)
7-
[![devDependency Status](https://david-dm.org/plotly/plotly.js/dev-status.svg?style=flat-square)](https://david-dm.org/plotly/plotly.js#info=devDependencies)
85

96
Built on top of [d3.js](http://d3js.org/) and [stack.gl](http://stack.gl/),
107
plotly.js is a high-level, declarative charting library. plotly.js ships with 20

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

+40-12
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,5 @@
11
/**
2-
* plotly.js v1.14.0
2+
* plotly.js v1.14.1
33
* Copyright 2012-2016, Plotly, Inc.
44
* All rights reserved.
55
* Licensed under the MIT license
@@ -60704,7 +60704,7 @@ exports.svgAttrs = {
6070460704
var Plotly = require('./plotly');
6070560705

6070660706
// package version injected by `npm run preprocess`
60707-
exports.version = '1.14.0';
60707+
exports.version = '1.14.1';
6070860708

6070960709
// plot api
6071060710
exports.plot = Plotly.plot;
@@ -83808,9 +83808,9 @@ proto.initInteractions = function() {
8380883808
Plotly.relayout(gd, attrs);
8380983809
}
8381083810

83811-
dragElement.init(dragOptions);
83812-
8381383811
// finally, set up hover and click
83812+
// these event handlers must already be set before dragElement.init
83813+
// so it can stash them and override them.
8381483814
dragger.onmousemove = function(evt) {
8381583815
fx.hover(gd, evt, _this.id);
8381683816
gd._fullLayout._lasthover = dragger;
@@ -83826,6 +83826,8 @@ proto.initInteractions = function() {
8382683826
dragger.onclick = function(evt) {
8382783827
fx.click(gd, evt);
8382883828
};
83829+
83830+
dragElement.init(dragOptions);
8382983831
};
8383083832

8383183833
function removeZoombox(gd) {
@@ -89255,15 +89257,15 @@ function plotOne(gd, plotinfo, cd) {
8925589257

8925689258
image3.enter().append('svg:image').attr({
8925789259
xmlns: xmlnsNamespaces.svg,
89258-
'xlink:href': canvas.toDataURL('image/png'),
8925989260
preserveAspectRatio: 'none'
8926089261
});
8926189262

8926289263
image3.attr({
8926389264
height: imageHeight,
8926489265
width: imageWidth,
8926589266
x: left,
89266-
y: top
89267+
y: top,
89268+
'xlink:href': canvas.toDataURL('image/png')
8926789269
});
8926889270

8926989271
image3.exit().remove();
@@ -93250,6 +93252,11 @@ module.exports = function hoverPoints(pointData, xval, yval, hovermode) {
9325093252
}
9325193253

9325293254
if(inside) {
93255+
// constrain ymin/max to the visible plot, so the label goes
93256+
// at the middle of the piece you can see
93257+
ymin = Math.max(ymin, 0);
93258+
ymax = Math.min(ymax, ya._length);
93259+
9325393260
// find the overall left-most and right-most points of the
9325493261
// polygon(s) we're inside at their combined vertical midpoint.
9325593262
// This is where we will draw the hover label.
@@ -93271,6 +93278,10 @@ module.exports = function hoverPoints(pointData, xval, yval, hovermode) {
9327193278
}
9327293279
}
9327393280

93281+
// constrain xmin/max to the visible plot now too
93282+
xmin = Math.max(xmin, 0);
93283+
xmax = Math.min(xmax, xa._length);
93284+
9327493285
// get only fill or line color for the hover color
9327593286
var color = Color.defaultLine;
9327693287
if(Color.opacity(trace.fillcolor)) color = trace.fillcolor;
@@ -96665,12 +96676,29 @@ module.exports = function hoverPoints(pointData, xval, yval, hovermode) {
9666596676
var scatterPointData = scatterHover(pointData, xval, yval, hovermode);
9666696677
if(!scatterPointData || scatterPointData[0].index === false) return;
9666796678

96668-
// if hovering on a fill, we don't show any point data so the label is
96669-
// unchanged from what scatter gives us.
96670-
if(scatterPointData[0].index === undefined) return scatterPointData;
96679+
var newPointData = scatterPointData[0];
9667196680

96672-
var newPointData = scatterPointData[0],
96673-
cdi = newPointData.cd[newPointData.index];
96681+
// if hovering on a fill, we don't show any point data so the label is
96682+
// unchanged from what scatter gives us - except that it needs to
96683+
// be constrained to the trianglular plot area, not just the rectangular
96684+
// area defined by the synthetic x and y axes
96685+
// TODO: in some cases the vertical middle of the shape is not within
96686+
// the triangular viewport at all, so the label can become disconnected
96687+
// from the shape entirely. But calculating what portion of the shape
96688+
// is actually visible, as constrained by the diagonal axis lines, is not
96689+
// so easy and anyway we lost the information we would have needed to do
96690+
// this inside scatterHover.
96691+
if(newPointData.index === undefined) {
96692+
var yFracUp = 1 - (newPointData.y0 / pointData.ya._length),
96693+
xLen = pointData.xa._length,
96694+
xMin = xLen * yFracUp / 2,
96695+
xMax = xLen - xMin;
96696+
newPointData.x0 = Math.max(Math.min(newPointData.x0, xMax), xMin);
96697+
newPointData.x1 = Math.max(Math.min(newPointData.x1, xMax), xMin);
96698+
return scatterPointData;
96699+
}
96700+
96701+
var cdi = newPointData.cd[newPointData.index];
9667496702

9667596703
newPointData.a = cdi.a;
9667696704
newPointData.b = cdi.b;
@@ -96867,7 +96895,7 @@ function makeContourProjAttr(axLetter) {
9686796895
dflt: false,
9686896896
description: [
9686996897
'Determines whether or not these contour lines are projected',
96870-
'on the', axLetter, 'axis walls.',
96898+
'on the', axLetter, 'plane.',
9687196899
'If `highlight` is set to *true* (the default), the projected',
9687296900
'lines are shown on hover.',
9687396901
'If `show` is set to *true*, the projected lines are shown',

dist/plotly.js

+39-11
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,5 @@
11
/**
2-
* plotly.js v1.14.0
2+
* plotly.js v1.14.1
33
* Copyright 2012-2016, Plotly, Inc.
44
* All rights reserved.
55
* Licensed under the MIT license
@@ -60280,7 +60280,7 @@ exports.svgAttrs = {
6028060280
var Plotly = require('./plotly');
6028160281

6028260282
// package version injected by `npm run preprocess`
60283-
exports.version = '1.14.0';
60283+
exports.version = '1.14.1';
6028460284

6028560285
// plot api
6028660286
exports.plot = Plotly.plot;
@@ -82930,9 +82930,9 @@ proto.initInteractions = function() {
8293082930
Plotly.relayout(gd, attrs);
8293182931
}
8293282932

82933-
dragElement.init(dragOptions);
82934-
8293582933
// finally, set up hover and click
82934+
// these event handlers must already be set before dragElement.init
82935+
// so it can stash them and override them.
8293682936
dragger.onmousemove = function(evt) {
8293782937
fx.hover(gd, evt, _this.id);
8293882938
gd._fullLayout._lasthover = dragger;
@@ -82948,6 +82948,8 @@ proto.initInteractions = function() {
8294882948
dragger.onclick = function(evt) {
8294982949
fx.click(gd, evt);
8295082950
};
82951+
82952+
dragElement.init(dragOptions);
8295182953
};
8295282954

8295382955
function removeZoombox(gd) {
@@ -88192,15 +88194,15 @@ function plotOne(gd, plotinfo, cd) {
8819288194

8819388195
image3.enter().append('svg:image').attr({
8819488196
xmlns: xmlnsNamespaces.svg,
88195-
'xlink:href': canvas.toDataURL('image/png'),
8819688197
preserveAspectRatio: 'none'
8819788198
});
8819888199

8819988200
image3.attr({
8820088201
height: imageHeight,
8820188202
width: imageWidth,
8820288203
x: left,
88203-
y: top
88204+
y: top,
88205+
'xlink:href': canvas.toDataURL('image/png')
8820488206
});
8820588207

8820688208
image3.exit().remove();
@@ -91888,6 +91890,11 @@ module.exports = function hoverPoints(pointData, xval, yval, hovermode) {
9188891890
}
9188991891

9189091892
if(inside) {
91893+
// constrain ymin/max to the visible plot, so the label goes
91894+
// at the middle of the piece you can see
91895+
ymin = Math.max(ymin, 0);
91896+
ymax = Math.min(ymax, ya._length);
91897+
9189191898
// find the overall left-most and right-most points of the
9189291899
// polygon(s) we're inside at their combined vertical midpoint.
9189391900
// This is where we will draw the hover label.
@@ -91909,6 +91916,10 @@ module.exports = function hoverPoints(pointData, xval, yval, hovermode) {
9190991916
}
9191091917
}
9191191918

91919+
// constrain xmin/max to the visible plot now too
91920+
xmin = Math.max(xmin, 0);
91921+
xmax = Math.min(xmax, xa._length);
91922+
9191291923
// get only fill or line color for the hover color
9191391924
var color = Color.defaultLine;
9191491925
if(Color.opacity(trace.fillcolor)) color = trace.fillcolor;
@@ -95193,12 +95204,29 @@ module.exports = function hoverPoints(pointData, xval, yval, hovermode) {
9519395204
var scatterPointData = scatterHover(pointData, xval, yval, hovermode);
9519495205
if(!scatterPointData || scatterPointData[0].index === false) return;
9519595206

95196-
// if hovering on a fill, we don't show any point data so the label is
95197-
// unchanged from what scatter gives us.
95198-
if(scatterPointData[0].index === undefined) return scatterPointData;
95207+
var newPointData = scatterPointData[0];
9519995208

95200-
var newPointData = scatterPointData[0],
95201-
cdi = newPointData.cd[newPointData.index];
95209+
// if hovering on a fill, we don't show any point data so the label is
95210+
// unchanged from what scatter gives us - except that it needs to
95211+
// be constrained to the trianglular plot area, not just the rectangular
95212+
// area defined by the synthetic x and y axes
95213+
// TODO: in some cases the vertical middle of the shape is not within
95214+
// the triangular viewport at all, so the label can become disconnected
95215+
// from the shape entirely. But calculating what portion of the shape
95216+
// is actually visible, as constrained by the diagonal axis lines, is not
95217+
// so easy and anyway we lost the information we would have needed to do
95218+
// this inside scatterHover.
95219+
if(newPointData.index === undefined) {
95220+
var yFracUp = 1 - (newPointData.y0 / pointData.ya._length),
95221+
xLen = pointData.xa._length,
95222+
xMin = xLen * yFracUp / 2,
95223+
xMax = xLen - xMin;
95224+
newPointData.x0 = Math.max(Math.min(newPointData.x0, xMax), xMin);
95225+
newPointData.x1 = Math.max(Math.min(newPointData.x1, xMax), xMin);
95226+
return scatterPointData;
95227+
}
95228+
95229+
var cdi = newPointData.cd[newPointData.index];
9520295230

9520395231
newPointData.a = cdi.a;
9520495232
newPointData.b = cdi.b;

dist/plotly.min.js

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

package.json

+3-3
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,6 @@
11
{
22
"name": "plotly.js",
3-
"version": "1.14.0",
3+
"version": "1.14.1",
44
"description": "The open source javascript graphing library that powers plotly",
55
"license": "MIT",
66
"main": "./lib/index.js",
@@ -90,13 +90,13 @@
9090
"browserify": "^13.0.0",
9191
"browserify-transform-tools": "^1.5.1",
9292
"ecstatic": "^1.4.0",
93-
"eslint": "^2.8.0",
93+
"eslint": "^3.0.0",
9494
"falafel": "^1.2.0",
9595
"fs-extra": "^0.30.0",
9696
"fuse.js": "^2.2.0",
9797
"glob": "^7.0.0",
9898
"jasmine-core": "^2.4.1",
99-
"karma": "^0.13.15",
99+
"karma": "^1.1.0",
100100
"karma-browserify": "^5.0.1",
101101
"karma-chrome-launcher": "^1.0.1",
102102
"karma-coverage": "^1.0.0",

src/assets/geo_assets.js

+1-1
Original file line numberDiff line numberDiff line change
@@ -12,6 +12,6 @@ var saneTopojson = require('sane-topojson');
1212

1313

1414
// package version injected by `npm run preprocess`
15-
exports.version = '1.14.0';
15+
exports.version = '1.14.1';
1616

1717
exports.topojson = saneTopojson;

src/core.js

+1-1
Original file line numberDiff line numberDiff line change
@@ -15,7 +15,7 @@
1515
var Plotly = require('./plotly');
1616

1717
// package version injected by `npm run preprocess`
18-
exports.version = '1.14.0';
18+
exports.version = '1.14.1';
1919

2020
// plot api
2121
exports.plot = Plotly.plot;

src/plots/mapbox/layers.js

+13-5
Original file line numberDiff line numberDiff line change
@@ -27,12 +27,21 @@ function MapboxLayer(mapbox, index) {
2727
this.source = null;
2828
this.layerType = null;
2929
this.below = null;
30+
31+
// is layer currently visible
32+
this.visible = false;
3033
}
3134

3235
var proto = MapboxLayer.prototype;
3336

3437
proto.update = function update(opts) {
35-
if(this.needsNewSource(opts)) {
38+
if(!this.visible) {
39+
40+
// IMPORTANT: must create source before layer to not cause errors
41+
this.updateSource(opts);
42+
this.updateLayer(opts);
43+
}
44+
else if(this.needsNewSource(opts)) {
3645

3746
// IMPORTANT: must delete layer before source to not cause errors
3847
this.updateLayer(opts);
@@ -43,6 +52,8 @@ proto.update = function update(opts) {
4352
}
4453

4554
this.updateStyle(opts);
55+
56+
this.visible = isVisible(opts);
4657
};
4758

4859
proto.needsNewSource = function(opts) {
@@ -209,10 +220,7 @@ function convertSourceOpts(opts) {
209220
module.exports = function createMapboxLayer(mapbox, index, opts) {
210221
var mapboxLayer = new MapboxLayer(mapbox, index);
211222

212-
// IMPORTANT: must create source before layer to not cause errors
213-
mapboxLayer.updateSource(opts);
214-
mapboxLayer.updateLayer(opts);
215-
mapboxLayer.updateStyle(opts);
223+
mapboxLayer.update(opts);
216224

217225
return mapboxLayer;
218226
};

src/plots/mapbox/layout_attributes.js

+1-1
Original file line numberDiff line numberDiff line change
@@ -191,7 +191,7 @@ module.exports = {
191191
dflt: 2,
192192
role: 'style',
193193
description: [
194-
'Sets the line radius.',
194+
'Sets the line width.',
195195
'Has an effect only when `type` is set to *line*.'
196196
].join(' ')
197197
}

src/plots/ternary/ternary.js

+4-2
Original file line numberDiff line numberDiff line change
@@ -659,9 +659,9 @@ proto.initInteractions = function() {
659659
Plotly.relayout(gd, attrs);
660660
}
661661

662-
dragElement.init(dragOptions);
663-
664662
// finally, set up hover and click
663+
// these event handlers must already be set before dragElement.init
664+
// so it can stash them and override them.
665665
dragger.onmousemove = function(evt) {
666666
fx.hover(gd, evt, _this.id);
667667
gd._fullLayout._lasthover = dragger;
@@ -677,6 +677,8 @@ proto.initInteractions = function() {
677677
dragger.onclick = function(evt) {
678678
fx.click(gd, evt);
679679
};
680+
681+
dragElement.init(dragOptions);
680682
};
681683

682684
function removeZoombox(gd) {

0 commit comments

Comments
 (0)