-
-
Notifications
You must be signed in to change notification settings - Fork 1.9k
Etienne devtools improvements #418
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Changes from all commits
File filter
Filter by extension
Conversations
Jump to
Diff view
Diff view
There are no files selected for viewing
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,6 +1,12 @@ | ||
'use strict'; | ||
|
||
/* global Plotly:false */ | ||
|
||
var Fuse = require('fuse.js'); | ||
var mocks = require('../../build/test_dashboard_mocks.json'); | ||
|
||
// put d3 in window scope | ||
var d3 = window.d3 = Plotly.d3; | ||
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. I use this a lot to debug. Typing |
||
|
||
// Our gracious testing object | ||
var Tabs = { | ||
|
@@ -35,8 +41,8 @@ var Tabs = { | |
plotMock: function(mockName, id) { | ||
var mockURL = '/test/image/mocks/' + mockName + '.json'; | ||
|
||
window.Plotly.d3.json(mockURL, function(err, fig) { | ||
window.Plotly.plot(Tabs.fresh(id), fig.data, fig.layout); | ||
d3.json(mockURL, function(err, fig) { | ||
Plotly.plot(Tabs.fresh(id), fig.data, fig.layout); | ||
|
||
console.warn('Plotting:', mockURL); | ||
}); | ||
|
@@ -47,12 +53,13 @@ var Tabs = { | |
var gd = Tabs.getGraph(id); | ||
|
||
if(!gd._fullLayout || !gd._fullData) { | ||
console.error('no graph with id ' + id + ' found.'); | ||
return; | ||
} | ||
|
||
var image = new Image(); | ||
|
||
window.Plotly.Snapshot.toImage(gd, { format: 'png' }).on('success', function(img) { | ||
Plotly.Snapshot.toImage(gd, { format: 'png' }).on('success', function(img) { | ||
image.src = img; | ||
|
||
var imageDiv = document.getElementById('snapshot'); | ||
|
@@ -72,7 +79,7 @@ var Tabs = { | |
} | ||
|
||
for(var i = 0; i < plots.length; i++) { | ||
window.Plotly.purge(plots[i]); | ||
Plotly.purge(plots[i]); | ||
} | ||
}, | ||
|
||
|
Original file line number | Diff line number | Diff line change |
---|---|---|
|
@@ -134,22 +134,23 @@ function writeFilePromise(path, contents) { | |
function bundlePlotly() { | ||
b.bundle(function(err) { | ||
if(err) { | ||
console.error('Error while bundling!', err); | ||
console.error('Error while bundling!', JSON.stringify(String(err))); | ||
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. |
||
} else { | ||
console.log('Bundle updated at ' + new Date().toLocaleTimeString()); | ||
} | ||
|
||
if(firstBundle) { | ||
open('http://localhost:' + PORT + '/devtools/test_dashboard'); | ||
firstBundle = false; | ||
} | ||
console.log('Bundle updated at ' + new Date().toLocaleTimeString()); | ||
}).pipe(fs.createWriteStream(constants.pathToPlotlyBuild)); | ||
} | ||
|
||
function bundleDevtools() { | ||
return new Promise(function(resolve, reject) { | ||
devtools.bundle(function(err) { | ||
if(err) { | ||
console.error('Error while bundling!', err); | ||
console.error('Error while bundling!', JSON.stringify(String(err))); | ||
return reject(err); | ||
} else { | ||
return resolve(); | ||
|
Original file line number | Diff line number | Diff line change |
---|---|---|
|
@@ -61,4 +61,5 @@ header span{ | |
} | ||
.dashboard-plot{ | ||
margin-bottom: 30px; | ||
width: 1100px; | ||
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. full window width default width deforms most plots. I think There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. There's code in There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. Right, most mock do have |
||
} |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Wasn't sure what our stance was on file-specific eslint settings. 👍
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
if you make
npm run lint
happy, then 👍