Skip to content

Commit d628461

Browse files
committed
Merge remote-tracking branch 'origin/master' into finalist-cluster-scattermapbox
2 parents 05dc1bf + ff41d70 commit d628461

File tree

17 files changed

+445
-286
lines changed

17 files changed

+445
-286
lines changed

devtools/test_dashboard/devtools.js

Lines changed: 16 additions & 19 deletions
Original file line numberDiff line numberDiff line change
@@ -6,8 +6,6 @@ var Fuse = require('fuse.js/dist/fuse.common.js');
66
var mocks = require('../../build/test_dashboard_mocks.json');
77
var credentials = require('../../build/credentials.json');
88
var Lib = require('@src/lib');
9-
var d3 = require('../../test/strict-d3');
10-
var d3Json = d3.json;
119

1210
require('./perf');
1311

@@ -60,23 +58,23 @@ var Tabs = {
6058
plotMock: function(mockName, id) {
6159
var mockURL = '/test/image/mocks/' + mockName + '.json';
6260

63-
d3Json(mockURL, function(err, fig) {
64-
Plotly.newPlot(Tabs.fresh(id), fig);
65-
66-
console.warn('Plotting:', mockURL);
67-
});
68-
},
69-
70-
getMock: function(mockName, callback) {
71-
var mockURL = '/test/image/mocks/' + mockName + '.json';
72-
73-
d3Json(mockURL, function(err, fig) {
74-
if(typeof callback !== 'function') {
75-
window.mock = fig;
76-
} else {
77-
callback(err, fig);
61+
console.warn('Plotting:', mockURL);
62+
63+
var request = new XMLHttpRequest();
64+
request.open('GET', mockURL, true);
65+
request.responseType = '';
66+
request.send();
67+
68+
request.onreadystatechange = function() {
69+
if(this.readyState === 4) {
70+
if(this.status === 200) {
71+
var fig = JSON.parse(this.responseText);
72+
Plotly.newPlot(Tabs.fresh(id), fig);
73+
} else {
74+
console.error(this.statusText);
75+
}
7876
}
79-
});
77+
};
8078
},
8179

8280
// Save a png snapshot and display it below the plot
@@ -152,7 +150,6 @@ var Tabs = {
152150
// Bind things to the window
153151
window.Tabs = Tabs;
154152
window.Lib = Lib;
155-
window.d3 = d3;
156153
window.onload = handleOnLoad;
157154
setInterval(function() {
158155
window.gd = Tabs.getGraph() || Tabs.fresh();

draftlogs/5832_change.md

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1 @@
1+
- Simplify devtool by relying on `XMLHttpRequest` instead of `d3.json` [[#5832](https://github.com/plotly/plotly.js/pull/5832)]

draftlogs/5836_fix.md

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1 @@
1+
- Fix `scatter` and `scattergl` hover on axes with period and adjust the unified hover position in respect to mean [[#5836](https://github.com/plotly/plotly.js/pull/5836)]

draftlogs/5838_fix.md

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,2 @@
1+
- Fix unknown filename when exporting charts using new versions of Safari [[#5609](https://github.com/plotly/plotly.js/pull/5609), [5838](https://github.com/plotly/plotly.js/pull/5838)],
2+
with thanks to @rlreamy for the contribution!

package-lock.json

Lines changed: 65 additions & 41 deletions
Some generated files are not rendered by default. Learn more about customizing how changed files appear on GitHub.

package.json

Lines changed: 7 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -24,14 +24,15 @@
2424
"custom-bundle": "node tasks/custom_bundle.js",
2525
"bundle": "node tasks/bundle.js",
2626
"extra-bundles": "node tasks/extra_bundles.js",
27+
"locales": "node tasks/locales.js",
2728
"schema": "node tasks/schema.js",
2829
"stats": "node tasks/stats.js",
2930
"find-strings": "node tasks/find_locale_strings.js",
3031
"preprocess": "node tasks/preprocess.js",
3132
"use-draftlogs": "node tasks/use_draftlogs.js",
3233
"empty-draftlogs": "node tasks/empty_draftlogs.js",
3334
"empty-dist": "node tasks/empty_dist.js",
34-
"build": "npm run empty-dist && npm run preprocess && npm run find-strings && npm run bundle && npm run extra-bundles && npm run schema dist && npm run stats",
35+
"build": "npm run empty-dist && npm run preprocess && npm run find-strings && npm run bundle && npm run extra-bundles basic && npm run extra-bundles cartesian && npm run extra-bundles geo && npm run extra-bundles gl2d && npm run extra-bundles gl3d && npm run extra-bundles mapbox && npm run extra-bundles finance && npm run extra-bundles strict && npm run locales && npm run schema dist && npm run stats",
3536
"cibuild": "npm run empty-dist && npm run preprocess && node tasks/cibundle.js",
3637
"watch": "node tasks/watch.js",
3738
"lint": "eslint --version && eslint .",
@@ -149,19 +150,19 @@
149150
"deep-equal": "^2.0.5",
150151
"derequire": "^2.1.1",
151152
"ecstatic": "^4.1.4",
152-
"eslint": "^7.28.0",
153+
"eslint": "^7.31.0",
153154
"espree": "^7.3.1",
154155
"extra-iterable": "^2.5.22",
155156
"falafel": "^2.2.4",
156157
"fs-extra": "^10.0.0",
157158
"fuse.js": "^6.4.6",
158-
"glob": "^7.1.6",
159+
"glob": "^7.1.7",
159160
"gzip-size": "^6.0.0",
160161
"into-stream": "^6.0.0",
161162
"jasmine-core": "^3.5.0",
162163
"jsdom": "^16.6.0",
163164
"karma": "^6.3.4",
164-
"karma-browserify": "^8.0.0",
165+
"karma-browserify": "^8.1.0",
165166
"karma-chrome-launcher": "^3.1.0",
166167
"karma-firefox-launcher": "^2.1.1",
167168
"karma-ie-launcher": "^1.0.0",
@@ -176,14 +177,14 @@
176177
"minify-stream": "^2.1.0",
177178
"mkdirp": "^1.0.4",
178179
"npm-link-check": "^4.0.0",
179-
"open": "^8.2.0",
180+
"open": "^8.2.1",
180181
"pixelmatch": "^5.2.1",
181182
"prepend-file": "^2.0.0",
182183
"prettysize": "^2.0.0",
183184
"read-last-lines": "^1.8.0",
184185
"run-series": "^1.1.9",
185186
"sane-topojson": "^4.0.0",
186-
"sass": "^1.35.1",
187+
"sass": "^1.35.2",
187188
"through2": "^4.0.2",
188189
"true-case-path": "^2.2.1",
189190
"watchify": "^4.0.0"

src/components/fx/hover.js

Lines changed: 5 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1072,8 +1072,11 @@ function createHoverText(hoverData, opts, gd) {
10721072

10731073
// Position the hover
10741074
var winningPoint = hoverData[0];
1075-
var ly = (winningPoint.y0 + winningPoint.y1) / 2;
1076-
var lx = (winningPoint.x0 + winningPoint.x1) / 2;
1075+
var ly = axLetter === 'y' ?
1076+
(winningPoint.y0 + winningPoint.y1) / 2 : Lib.mean(hoverData.map(function(c) {return (c.y0 + c.y1) / 2;}));
1077+
var lx = axLetter === 'x' ?
1078+
(winningPoint.x0 + winningPoint.x1) / 2 : Lib.mean(hoverData.map(function(c) {return (c.x0 + c.x1) / 2;}));
1079+
10771080
var legendContainer = container.select('g.legend');
10781081
var tbb = legendContainer.node().getBoundingClientRect();
10791082
lx += xa._offset;

src/snapshot/filesaver.js

Lines changed: 7 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -23,13 +23,6 @@ function fileSaver(url, name, format) {
2323
var blob;
2424
var objectUrl;
2525

26-
// Safari doesn't allow downloading of blob urls
27-
if(Lib.isSafari()) {
28-
var prefix = format === 'svg' ? ',' : ';base64,';
29-
helpers.octetStream(prefix + encodeURIComponent(url));
30-
return resolve(name);
31-
}
32-
3326
// IE 10+ (native saveAs)
3427
if(Lib.isIE()) {
3528
// At this point we are only dealing with a decoded SVG as
@@ -56,6 +49,13 @@ function fileSaver(url, name, format) {
5649
return resolve(name);
5750
}
5851

52+
// Older versions of Safari did not allow downloading of blob urls
53+
if(Lib.isSafari()) {
54+
var prefix = format === 'svg' ? ',' : ';base64,';
55+
helpers.octetStream(prefix + encodeURIComponent(url));
56+
return resolve(name);
57+
}
58+
5959
reject(new Error('download error'));
6060
});
6161

src/traces/scatter/calc.js

Lines changed: 0 additions & 10 deletions
Original file line numberDiff line numberDiff line change
@@ -51,23 +51,13 @@ function calc(gd, trace) {
5151
calcAxisExpansion(gd, trace, xa, ya, x, y, ppad);
5252
}
5353

54-
var hasPeriodX = !!trace.xperiodalignment;
55-
var hasPeriodY = !!trace.yperiodalignment;
56-
5754
for(i = 0; i < serieslen; i++) {
5855
var cdi = cd[i] = {};
5956
var xValid = isNumeric(x[i]);
6057
var yValid = isNumeric(y[i]);
6158
if(xValid && yValid) {
6259
cdi[xAttr] = x[i];
6360
cdi[yAttr] = y[i];
64-
65-
if(hasPeriodX) {
66-
cdi.orig_x = origX[i]; // used by hover
67-
}
68-
if(hasPeriodY) {
69-
cdi.orig_y = origY[i]; // used by hover
70-
}
7161
} else if(stackGroupOpts && (isV ? xValid : yValid)) {
7262
// if we're stacking we need to hold on to all valid positions
7363
// even with invalid sizes

0 commit comments

Comments
 (0)