Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
35 changes: 16 additions & 19 deletions devtools/test_dashboard/devtools.js
Original file line number Diff line number Diff line change
Expand Up @@ -6,8 +6,6 @@ var Fuse = require('fuse.js/dist/fuse.common.js');
var mocks = require('../../build/test_dashboard_mocks.json');
var credentials = require('../../build/credentials.json');
var Lib = require('@src/lib');
var d3 = require('../../test/strict-d3');
var d3Json = d3.json;

require('./perf');

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

d3Json(mockURL, function(err, fig) {
Plotly.newPlot(Tabs.fresh(id), fig);

console.warn('Plotting:', mockURL);
});
},

getMock: function(mockName, callback) {
var mockURL = '/test/image/mocks/' + mockName + '.json';

d3Json(mockURL, function(err, fig) {
if(typeof callback !== 'function') {
window.mock = fig;
} else {
callback(err, fig);
console.warn('Plotting:', mockURL);

var request = new XMLHttpRequest();
request.open('GET', mockURL, true);
request.responseType = '';
request.send();

request.onreadystatechange = function() {
if(this.readyState === 4) {
if(this.status === 200) {
var fig = JSON.parse(this.responseText);
Plotly.newPlot(Tabs.fresh(id), fig);
} else {
console.error(this.statusText);
}
}
});
};
},

// Save a png snapshot and display it below the plot
Expand Down Expand Up @@ -152,7 +150,6 @@ var Tabs = {
// Bind things to the window
window.Tabs = Tabs;
window.Lib = Lib;
window.d3 = d3;
window.onload = handleOnLoad;
setInterval(function() {
window.gd = Tabs.getGraph() || Tabs.fresh();
Expand Down
1 change: 1 addition & 0 deletions draftlogs/5832_change.md
Original file line number Diff line number Diff line change
@@ -0,0 +1 @@
- Simplify devtool by relying on `XMLHttpRequest` instead of `d3.json` [[#5832](https://github.com/plotly/plotly.js/pull/5832)]