Howto export jQuery flot graphs as images? [duplicate]
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?
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.
精彩评论