JqPlot作为图像

109*_*793 11 jquery jqplot

在最新的JqPlot示例中(请参阅此处,您可以单击某些图表下方的按钮,并且div将图表作为图像向下滑动,允许您右键单击并另存为.

我检查了源代码,我只是看不到自己发生了什么.我已经看到了关于这个的各种讨论(请参阅此处,但我的javascript是最基本的.但这是我想在我当前的项目中实现的东西.

是否有人知道如何执行此操作的完整教程,即从实际的jquery代码到html代码中的实现.

Mar*_*ark 29

这是我可以编写的最简单的例子:

//after creating your plot do
var imgData = $('#chart1').jqplotToImageStr({}); // given the div id of your plot, get the img data
var imgElem = $('<img/>').attr('src',imgData); // create an img and add the data to it
$('#imgChart1').append(imgElem);?????????????????????????????????????????????????? // append the img to the DOM
Run Code Online (Sandbox Code Playgroud)

小提琴这里.

  • @wonza,抱歉你运气不好,来自jqplot源代码:'// excanvas因此IE <9不支持toDataURL而无法导出图像.if($ .jqplot.use_excanvas){return null; }' (3认同)