Skip to content

Commit 7fe4363

Browse files
committed
Merge branch 'dropline' of github.com:rpaskowitz/plotly.js into dropline
2 parents b9f6ab1 + 55b17b2 commit 7fe4363

Some content is hidden

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

53 files changed

+834
-514
lines changed

.github/PULL_REQUEST_TEMPLATE.md

Lines changed: 4 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -4,8 +4,9 @@ Developers are strongly encouraged to first make a PR to their own plotly.js for
44

55
Before opening a pull request, developer should:
66

7-
- `git rebase` their local branch off the latest `master`
8-
- make sure to **not** `git add` the `dist/` folder (the `dist/` is updated only on verion bumps)
9-
- write an overview of what the PR attempts to do.
7+
- `git rebase` their local branch off the latest `master`,
8+
- make sure to **not** `git add` the `dist/` folder (the `dist/` is updated only on verion bumps),
9+
- write an overview of what the PR attempts to do,
10+
- select the _Allow edits from maintainers_ option (see this [article](https://help.github.com/articles/allowing-changes-to-a-pull-request-branch-created-from-a-fork/) for more details).
1011

1112
Note that it is forbidden to force push (i.e. `git push -f`) to remote branches associated with opened pull requests. Force pushes make it hard for maintainers to keep track of updates. Therefore, if required, please `git merge master` into your PR branch instead of `git rebase master`.

package.json

Lines changed: 3 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -72,16 +72,17 @@
7272
"gl-mat4": "^1.1.2",
7373
"gl-mesh3d": "^1.2.0",
7474
"gl-plot2d": "^1.2.0",
75-
"gl-plot3d": "^1.5.2",
75+
"gl-plot3d": "^1.5.4",
7676
"gl-pointcloud2d": "^1.0.0",
7777
"gl-scatter2d": "^1.2.2",
78-
"gl-scatter2d-sdf": "^1.3.4",
78+
"gl-scatter2d-sdf": "1.3.4",
7979
"gl-scatter3d": "^1.0.4",
8080
"gl-select-box": "^1.0.1",
8181
"gl-shader": "4.2.0",
8282
"gl-spikes2d": "^1.0.1",
8383
"gl-surface3d": "^1.3.0",
8484
"mapbox-gl": "^0.22.0",
85+
"matrix-camera-controller": "^2.1.3",
8586
"mouse-change": "^1.4.0",
8687
"mouse-wheel": "^1.0.2",
8788
"ndarray": "^1.0.18",

src/components/errorbars/index.js

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -19,7 +19,7 @@ errorBars.calc = require('./calc');
1919

2020
errorBars.calcFromTrace = function(trace, layout) {
2121
var x = trace.x || [],
22-
y = trace.y,
22+
y = trace.y || [],
2323
len = x.length || y.length;
2424

2525
var calcdataMock = new Array(len);

src/lib/geojson_utils.js

Lines changed: 10 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -9,6 +9,8 @@
99

1010
'use strict';
1111

12+
var BADNUM = require('../constants/numerical').BADNUM;
13+
1214
/**
1315
* Convert calcTrace to GeoJSON 'MultiLineString' coordinate arrays
1416
*
@@ -21,18 +23,19 @@
2123
*
2224
*/
2325
exports.calcTraceToLineCoords = function(calcTrace) {
24-
var trace = calcTrace[0].trace,
25-
connectgaps = trace.connectgaps;
26+
var trace = calcTrace[0].trace;
27+
var connectgaps = trace.connectgaps;
2628

27-
var coords = [],
28-
lineString = [];
29+
var coords = [];
30+
var lineString = [];
2931

3032
for(var i = 0; i < calcTrace.length; i++) {
3133
var calcPt = calcTrace[i];
34+
var lonlat = calcPt.lonlat;
3235

33-
lineString.push(calcPt.lonlat);
34-
35-
if(!connectgaps && calcPt.gapAfter && lineString.length > 0) {
36+
if(lonlat[0] !== BADNUM) {
37+
lineString.push(lonlat);
38+
} else if(!connectgaps && lineString.length > 0) {
3639
coords.push(lineString);
3740
lineString = [];
3841
}

src/plots/mapbox/mapbox.js

Lines changed: 6 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -111,10 +111,14 @@ proto.createMap = function(calcData, fullLayout, resolve, reject) {
111111
});
112112

113113
// clear navigation container
114-
var className = constants.controlContainerClassName,
115-
controlContainer = self.div.getElementsByClassName(className)[0];
114+
var className = constants.controlContainerClassName;
115+
var controlContainer = self.div.getElementsByClassName(className)[0];
116116
self.div.removeChild(controlContainer);
117117

118+
// make sure canvas does not inherit left and top css
119+
map._canvas.canvas.style.left = '0px';
120+
map._canvas.canvas.style.top = '0px';
121+
118122
self.rejectOnError(reject);
119123

120124
map.once('load', function() {
@@ -176,7 +180,6 @@ proto.createMap = function(calcData, fullLayout, resolve, reject) {
176180

177181
map.on('dragstart', unhover);
178182
map.on('zoomstart', unhover);
179-
180183
};
181184

182185
proto.updateMap = function(calcData, fullLayout, resolve, reject) {

src/plots/plots.js

Lines changed: 10 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -16,6 +16,7 @@ var Plotly = require('../plotly');
1616
var Registry = require('../registry');
1717
var Lib = require('../lib');
1818
var Color = require('../components/color');
19+
var BADNUM = require('../constants/numerical').BADNUM;
1920

2021
var plots = module.exports = {};
2122

@@ -257,6 +258,9 @@ plots.previousPromises = function(gd) {
257258
* Add source links to your graph inside the 'showSources' config argument.
258259
*/
259260
plots.addLinks = function(gd) {
261+
// Do not do anything if showLink and showSources are not set to true in config
262+
if(!gd._context.showLink && !gd._context.showSources) return;
263+
260264
var fullLayout = gd._fullLayout;
261265

262266
var linkContainer = fullLayout._paper
@@ -824,14 +828,15 @@ plots.supplyTraceDefaults = function(traceIn, traceOutIndex, layout, traceInInde
824828
coerce('legendgroup');
825829
}
826830

827-
supplyTransformDefaults(traceIn, traceOut, layout);
831+
plots.supplyTransformDefaults(traceIn, traceOut, layout);
828832
}
829833

830834
return traceOut;
831835
};
832836

833-
function supplyTransformDefaults(traceIn, traceOut, layout) {
837+
plots.supplyTransformDefaults = function(traceIn, traceOut, layout) {
834838
var globalTransforms = layout._globalTransforms || [];
839+
var transformModules = layout._transformModules || [];
835840

836841
if(!Array.isArray(traceIn.transforms) && globalTransforms.length === 0) return;
837842

@@ -852,15 +857,15 @@ function supplyTransformDefaults(traceIn, traceOut, layout) {
852857
transformOut.type = type;
853858
transformOut._module = _module;
854859

855-
Lib.pushUnique(layout._transformModules, _module);
860+
Lib.pushUnique(transformModules, _module);
856861
}
857862
else {
858863
transformOut = Lib.extendFlat({}, transformIn);
859864
}
860865

861866
containerOut.push(transformOut);
862867
}
863-
}
868+
};
864869

865870
function applyTransforms(fullTrace, fullData, layout, fullLayout) {
866871
var container = fullTrace.transforms,
@@ -2012,11 +2017,8 @@ plots.doCalcdata = function(gd, traces) {
20122017
//
20132018
// This ensures there is a calcdata item for every trace,
20142019
// even if cartesian logic doesn't handle it (for things like legends).
2015-
//
2016-
// Tag this artificial calc point with 'placeholder: true',
2017-
// to make it easier to skip over them in during the plot and hover step.
20182020
if(!Array.isArray(cd) || !cd[0]) {
2019-
cd = [{x: false, y: false, placeholder: true}];
2021+
cd = [{x: BADNUM, y: BADNUM}];
20202022
}
20212023

20222024
// add the trace-wide properties to the first point,

src/traces/bar/arrays_to_calcdata.js

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -15,6 +15,7 @@ var mergeArray = require('../../lib').mergeArray;
1515
// arrayOk attributes, merge them into calcdata array
1616
module.exports = function arraysToCalcdata(cd, trace) {
1717
mergeArray(trace.text, cd, 'tx');
18+
mergeArray(trace.hovertext, cd, 'htx');
1819

1920
var marker = trace.marker;
2021
if(marker) {

src/traces/bar/attributes.js

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -49,6 +49,7 @@ module.exports = {
4949
dy: scatterAttrs.dy,
5050

5151
text: scatterAttrs.text,
52+
hovertext: scatterAttrs.hovertext,
5253

5354
textposition: {
5455
valType: 'enumerated',

src/traces/bar/defaults.js

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -37,6 +37,7 @@ module.exports = function supplyDefaults(traceIn, traceOut, defaultColor, layout
3737
coerce('width');
3838

3939
coerce('text');
40+
coerce('hovertext');
4041

4142
var textPosition = coerce('textposition');
4243

src/traces/bar/hover.js

Lines changed: 4 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -99,7 +99,10 @@ module.exports = function hoverPoints(pointData, xval, yval, hovermode) {
9999
pointData.xLabelVal = di.p;
100100
}
101101

102-
if(di.tx) pointData.text = di.tx;
102+
if(di.htx) pointData.text = di.htx;
103+
else if(trace.hovertext) pointData.text = trace.hovertext;
104+
else if(di.tx) pointData.text = di.tx;
105+
else if(trace.text) pointData.text = trace.text;
103106

104107
ErrorBars.hoverInfo(di, trace, pointData);
105108

0 commit comments

Comments
 (0)