如何将 jQuery flot 图表导出为图像?
是否可以保存使用 flot 作为图像? 如果是,怎么办?
Possible Duplicate:
How to save a jQuery FLOT Graph to a .png or orther image formate?
Is it possible to save graphs build with flot as images?
If yes, how?
如果你对这篇内容有疑问,欢迎到本站社区发帖提问 参与讨论,获取更多帮助,或者扫码二维码加入 Web 技术交流群。
绑定邮箱获取回复消息
由于您还没有绑定你的真实邮箱,如果其他用户或者作者回复了您的评论,将不能在第一时间通知您!
发布评论
评论(1)
当使用支持 HTML5 的浏览器时,flot 将图形输出到
自今年 5 月起,新的 HTML 5 规范即将推出,canvas.ToBlob() 但这需要相当长的时间才能得到支持。上次我读到,还没有人实现它,因为在规范更加清晰和最终确定之前还有一段等待的时间。
When working with HTML5-capable browsers, flot outputs graphs to a <canvas> element. The canvas element has a fairly widely-supported ToDataURL() method that you can use to write the canvas to a URI scheme string to use as an image source. What you do from the string from there is up to you, but MDN provides an example of saving the image, at least in the case of Firefox. At the very least you can create a new image element on your document and set its src to the result string, then allow a user to save the image.
Coming down the pipe as of this May is a new HTML 5 specification for canvas.ToBlob() but that will take quite some time before it's supported. Last I read, no one has yet implemented it, as there's a bit of a waiting game until the specification is clearer and more finalized.