How to save a jQuery FLOT Graph to a .png or other image format?

后端 未结 3 635
悲哀的现实
悲哀的现实 2020-12-08 11:06

I\'m using a plugin for Jquery called FLOT http://code.google.com/p/flot/

Once the graph is rendered I want the client to be able to save the graph to a file for lat

相关标签:
3条回答
  • 2020-12-08 11:12

    If you are willing to use Firefox, I wrote WWW::Mechanize::Firefox, which can save the whole page or elements on a page to PNG.

    You can also automate Firefox completely, which I do with ffeedflotr, a small data plotting program that creates flot charts.

    0 讨论(0)
  • 2020-12-08 11:29

    You might look into HighCharts which has an export and print feature. It works by generating all the graphics in SVG before rendering on the canvas. When a user wants an image, the javascript sends the SVG to the server for conversion into an image. See the Exporting Module for more details.

    The data structures for highcharts are well documented and not too hard to port flot to highcharts. They also have lots of examples you can interactively play with using jsFiddle.

    0 讨论(0)
  • 2020-12-08 11:31

    The basic way to do it is using canvas.toDataURL("image/png"); but I also found this link for you

    http://nihilogic.dk/labs/canvas2image/

    I've not tested it.

    0 讨论(0)
提交回复
热议问题