0

I have implemented a flot chart. What I wanna do is to save the graph to other formats like: PNG, JPG,... I managed to screenshot the graph and append bellow in the webpage when i click "Generate". And then I can right click on image and save it as PNG.

 $("#generate").on("click", function (e) {

                html2canvas($("#placeholder").get(0), {
                    onrendered: function (canvas) {
                        document.body.appendChild(canvas);

                        var imgData = canvas.toDataURL('image/png');
                        console.log('Report Image URL: ' + imgData);
                        var doc = new jsPDF('landscape');

                        doc.addImage(imgData, 'PNG', 10, 10, 190, 95);

                    }
                });
            });

and <a id="generate">Generate</a>

How could I do so when I click "Generate" to appear a Save Image As dialog?

Bioukh
  • 1,888
  • 1
  • 16
  • 27
Ionut
  • 724
  • 2
  • 9
  • 25
  • Check [here](http://stackoverflow.com/questions/19079758/simulate-save-image-as), [here](http://stackoverflow.com/questions/17397319/save-canvas-as-jpg-to-desktop) and [here](http://stackoverflow.com/questions/7951326/save-image-to-users-disk-using-javascript). – Michael Feb 10 '16 at 08:52
  • 3
    http://stackoverflow.com/questions/15616925/save-flot-graph-as-image – Piero Alberto Feb 10 '16 at 09:15

0 Answers0