Comments (15)
Yes, I just started working through this. Here is the very preliminary set of thoughts. By the end of the week, I hope to have a full plan to address this. Is that ok?
from plotly.js.
Ping, any update on this?
from plotly.js.
We're still doing experiments with potential APIs. No serious work has gone into this to date.
That said, once we figure out how to expose things to the users, this should be a 2-day project.
from plotly.js.
Once we're comfortable with the API, we should expose the toImage
on the Plotly
directly.
Moreover, we'll need toImage
to return a promise, like the other Plotly
async methods.
from plotly.js.
Is there a way to get raw PNG data from a plot snapshot? We would like to do this so that we can generate a PNG output in an IPython notebook so that when viewing the .ipynb file in Github or elsewhere where Javascript is not executed there is a static fallback version that gets displayed.
(and we need to do this in the Javascript code, not Python)
from plotly.js.
You should be able to do Plotly.Snapshot.toImage(gd, {"format": "png"})
, which will return a promise you then have to deal with resolving.
from plotly.js.
Thanks. I don't see docs on Plotly promises. I tried this:
var idata;
Plotly.Snapshot.toImage(model.dom.id, {"format": "png"}).then(function(d) { idata=d; })
but I get:
Plotly.Snapshot.toImage(...).then is not a function(…)
toImage()
is returning an EventEmitter.
What am I missing?
from plotly.js.
Ah, I see. I need to use ...toImage(...).once('success', function(url) { ...})
from plotly.js.
I think that for the user it would be really interesting to be able to choose the image size. But also it could be too much features on the plot and reduce simplicity...
I would suggest that the coder who is buiding the plot could choose if the users (the ones who will be watching the plot) are capable to change or not the PNG image from the plot.
To do so I would suggest to add inside the layout variable an option which involves the modebar, and where it could be such a variable like "snapshotsize" which could admit a vector including a fixed size: snapshotsize = [1000 1000]
or either the auto option snapshotsize = "auto"
Regarding the "auto"
functionality I would suggest that a dialog box appears on the plot allowing to choose the dimension of it. Somehow similar to the message box which appears when you click the snapshot button and it tells you that Taking snapshot - this may take a few seconds
With this implementation the current way that snapshots are being done right now can be kept (as the coder can decide the output size) but also the new feature of being able to choose the plot size can be implemented.
from plotly.js.
Unfortunately other obligations came up for the plotly.js team members and this issue will remain on hold until at least April 1.
Our apologies.
from plotly.js.
Related discussion: http://community.plot.ly/t/use-plotly-offline-to-save-chart-as-image-file/408/8
from plotly.js.
For what it is worth, in PlotlyJS.jl I can get true vector image pdf/eps/svg export as well as configurable png/jpeg exporting by getting the svg data from plotly, using librsvg to load that into cairo, and using cairo to render to the desired file type.
from plotly.js.
@timelyportfolio have you made any progress on this one?
from plotly.js.
timelyportfolio#1 (comment) is my first attempt, and it seems we now have both 2) promises and 3) resize. I would appreciate any thoughts.
from plotly.js.
done in #446
from plotly.js.
Related Issues (20)
- Mismatch between legend and line colors when using uppercase css colors HOT 1
- Item toggle behavior when using multiple legends HOT 8
- insiderange on multiple overlaid axes edge case
- [Feature Request] Adding a Button to Copy Image to Clipboard HOT 1
- BUG: standoff causes axis title position to break if no tick labels
- Shapes - fill to infinity/-infinity
- Adding a dendrogram to heatmaps
- Smith Chart (scattersmith) pan & zoom functionality HOT 2
- axes range not working. Range is +-1, data is 0->1.6e10 HOT 3
- ScatterGL throws ` TypeError: r[v] is undefined` when using frames HOT 1
- Clicks are sometimes missed with clickmode layout key HOT 4
- Tooltip pointer (triangle) not correctly positioned with hovermode 'x'
- Plotly chart conflict with touchstart / touchmove event to scroll smartphone screen HOT 1
- [BUG] Rangeslider won't reset after zooming out HOT 1
- Inconsistent behavior when providing an array of marker sizes in "markers" mode on scatter3D
- hoverdistance broken in 3D scatter plots; hover radius vs click radius?
- `scattergl` line plots no longer working after upgrading to 2.29.1 HOT 3
- Combining rangemode tozero and tickformat set to "," produces unexpected results
- REOPENING BUG - pie chart hover label hidden
- Hoverlabel overlaps each other
Recommend Projects
-
React
A declarative, efficient, and flexible JavaScript library for building user interfaces.
-
Vue.js
🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.
-
Typescript
TypeScript is a superset of JavaScript that compiles to clean JavaScript output.
-
TensorFlow
An Open Source Machine Learning Framework for Everyone
-
Django
The Web framework for perfectionists with deadlines.
-
Laravel
A PHP framework for web artisans
-
D3
Bring data to life with SVG, Canvas and HTML. 📊📈🎉
-
Recommend Topics
-
javascript
JavaScript (JS) is a lightweight interpreted programming language with first-class functions.
-
web
Some thing interesting about web. New door for the world.
-
server
A server is a program made to process requests and deliver data to clients.
-
Machine learning
Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.
-
Visualization
Some thing interesting about visualization, use data art
-
Game
Some thing interesting about game, make everyone happy.
Recommend Org
-
Facebook
We are working to build community through open source technology. NB: members must have two-factor auth.
-
Microsoft
Open source projects and samples from Microsoft.
-
Google
Google ❤️ Open Source for everyone.
-
Alibaba
Alibaba Open Source for everyone
-
D3
Data-Driven Documents codes.
-
Tencent
China tencent open source team.
from plotly.js.