Thanks to visit codestin.com
Credit goes to github.com

Skip to content

Seamless subplots #554

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

Merged
merged 6 commits into from
May 20, 2016
Merged
Show file tree
Hide file tree
Changes from 1 commit
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
Next Next commit
snapshot: clean wait callback
- rm unnecessary 'window'
- rm commented out line (ne need to attach canvas to window)
  • Loading branch information
etpinard committed May 19, 2016
commit e85552120990030c2902437ad5175aa877fbd9d0
8 changes: 5 additions & 3 deletions src/plot_api/to_image.js
Original file line number Diff line number Diff line change
Expand Up @@ -61,11 +61,12 @@ function toImage(gd, opts) {
setTimeout(function() {
var svg = Snapshot.toSVG(clonedGd);

var canvasContainer = window.document.createElement('div');
var canvas = window.document.createElement('canvas');
var canvasContainer = document.createElement('div'),
canvas = document.createElement('canvas');

canvasContainer.appendChild(canvas);
// no need to attach canvas container to DOM
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Probably can ⚡ the comment.

Also, do we even the canvasContainer? Can't we just use the canvas element directly? Not 🚫 but it's always nice to remove code.


canvasContainer.appendChild(canvas);
canvasContainer.id = Plotly.Lib.randstr();
canvas.id = Plotly.Lib.randstr();

Expand All @@ -86,6 +87,7 @@ function toImage(gd, opts) {
}).catch(function(err) {
reject(err);
});

}, delay);
});
}
Expand Down
8 changes: 4 additions & 4 deletions src/snapshot/toimage.js
Original file line number Diff line number Diff line change
Expand Up @@ -38,12 +38,12 @@ function toImage(gd, opts) {
setTimeout(function() {
var svg = Plotly.Snapshot.toSVG(clonedGd);

var canvasContainer = window.document.createElement('div');
var canvas = window.document.createElement('canvas');
var canvasContainer = document.createElement('div'),
canvas = document.createElement('canvas');

// window.document.body.appendChild(canvasContainer);
canvasContainer.appendChild(canvas);
// no need to attach canvas container to DOM
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Same here.


canvasContainer.appendChild(canvas);
canvasContainer.id = Plotly.Lib.randstr();
canvas.id = Plotly.Lib.randstr();

Expand Down