I'm trying to save a flot chart to an image and eventually to a pdf, but can't quite figure out how.
Online I see that I can do
canvas.toDataURL("image/png")
But the trouble is how do I get the canvas in the first place, the examples say to use
document.getElementById("canvas");
but for my code I'm using a div with id="placeholder" (per all the flot examples) and there's nothing labeled with a canvas tag in my html, and this doesn't seem to work. My javascript for flot looks like
$.plot($("#placeholder"), [ d1, d2, d3 ], { series: {
lines: { show:false },
bars: { show: true, barWidth: 0.6, horizontal:true } } });
Does anyone have a working example that plots a flot graph and then has a button to either save/view as image or pdf?
There are several questions that sort of already answer this, but they are missing some key details as far as I can tell -- my apologies for being thick on this.