Javascript 我可以从jqplot';IE8和以前版本中的jqplotToImageStr({})函数?

Javascript 我可以从jqplot';IE8和以前版本中的jqplotToImageStr({})函数?,javascript,html5-canvas,jqplot,Javascript,Html5 Canvas,Jqplot,我依赖jqplot的jqplotToImageStr({})函数从图表中生成一个png作为base64字符串。然后我将base64表示发送到服务器以完成我的工作。问题是,当浏览器(在我的经验中,这是不可能的)时,jqplotToImageStr({})返回null。我们在服务器端检查字符串输入,如果输入为null,则向用户返回消息。尝试下面的javascript(从jqplot示例复制)。将其附加到页面末尾 <script> $(document).ready(functio

我依赖jqplot的jqplotToImageStr({})函数从图表中生成一个png作为base64字符串。然后我将base64表示发送到服务器以完成我的工作。问题是,当浏览器(在我的经验中,这是不可能的)时,jqplotToImageStr({})返回null。我们在服务器端检查字符串输入,如果输入为null,则向用户返回消息。

尝试下面的javascript(从jqplot示例复制)。将其附加到页面末尾

<script>
    $(document).ready(function(){if(!$.jqplot._noCodeBlock){$("script.code").each(function(c){if($("pre.code").eq(c).length){$("pre.code").eq(c).text($(this).html())}else{var d=$('<pre class="code prettyprint brush: js"></pre>');$("div.jqplot-target").eq(c).after(d);d.text($(this).html());d=null}});$("script.common").each(function(c){$("pre.common").eq(c).text($(this).html())});var b="";if($("script.include, link.include").length>0){if($("pre.include").length==0){var a=['<div class="code prettyprint include">','<p class="text">The charts on this page depend on the following files:</p>','<pre class="include prettyprint brush: html gutter: false"></pre>',"</div>"];a=$(a.join("\n"));$("div.example-content").append(a);a=null}$("script.include").each(function(c){if(b!==""){b+="\n"}b+='<script type="text/javascript" src="'+$(this).attr("src")+'"><\/script>'});$("link.include").each(function(c){if(b!==""){b+="\n"}b+='<link rel="stylesheet" type="text/css" hrf="'+$(this).attr("href")+'" />'});$("pre.include").text(b)}else{$("pre.include").remove();$("div.include").remove()}}if(!$.jqplot.use_excanvas){$("div.jqplot-target").each(function(){var d=$(document.createElement("div"));var g=$(document.createElement("div"));var f=$(document.createElement("div"));d.append(g);d.append(f);d.addClass("jqplot-image-container");g.addClass("jqplot-image-container-header");f.addClass("jqplot-image-container-content");g.html("Right Click to Save Image As...");var e=$(document.createElement("a"));e.addClass("jqplot-image-container-close");e.html("Close");e.attr("href","#");e.click(function(){$(this).parents("div.jqplot-image-container").hide(500)});g.append(e);$(this).after(d);d.hide();d=g=f=e=null;if(!$.jqplot._noToImageButton){var c=$(document.createElement("button"));c.text("View Plot Image");c.addClass("jqplot-image-button");c.bind("click",{chart:$(this)},function(h){var j=h.data.chart.jqplotToImageElem();var i=$(this).nextAll("div.jqplot-image-container").first();i.children("div.jqplot-image-container-content").empty();i.children("div.jqplot-image-container-content").append(j);i.show(500);i=null});$(this).after(c);c.after("<br />");c=null}})}$(document).unload(function(){$("*").unbind()})});
</script>

$(document).ready(function(){if(!$.jqplot._noCodeBlock){$(“script.code”).each(function(c){if($($).eq(c).eq(c).text($(this.html())}else{vard=$('');$($div.jqplot-target”).eq(c).在(d)之后;d.text($(this.html=);d=null}$($script common”)。each(c){.eq.html());(c);(c);(this.eq.html());(c);(c);(c);(c);(c);(c);(c);(c);(c);(c);(c);(c($(“script.include,link.include”).length>0{if($(“pre.include”).length==0{var a=['',

此页上的图表取决于以下文件:

','',''”];a=$(a.join(“\n”);$(“div.example-content”).append(a);a=null}$(“script.include”).each(函数(c){if(b!==”{b+=“{b+=”){b+=“}b+=”}b+=”;($link include”);each(函数)(c)=”{b+=“}{b}b}b}如果(!$.jqplot.use_excanvas){$((div.jqplot-target”)。每个(function(){var d=$(document.createElement(“div”);var g=$(document.createElement(“div”);var f=$(document.createElement(“div”);var f=$(document.createElement(“div”);d.append(g);d.append(f);d.addClass(“jqplot-image”)容器jqplot image container header);f.addClass(“jqplot image container content”);g.html(“右键单击以将图像另存为…”);var e=$(document.createElement(“a”);e.addClass(“jqplot image container close”);e.html(“close”);e.attr(“href”、“#”);e.Click(函数(){$(this).parents(“div.jqplot-image-container”).hide(500)});g.append(e);$(this)。在(d)之后;d=g=f=e=null;if(!$.jqplot.\u notimagebutton){var c=$(document.createElement(“button”);c.text(“查看绘图图像”);c.addClass(“jqplot图像按钮”);c.bind(“单击“,{chart:$(this)},函数(h){var j=h.data.chart.jqplottoimageleem();var i=$(this.nextAll(“div.jqplot-Image-container”).first();i.childrent(“div.jqplot-Image-container-container”)空();i.children(“div.jqplot-image-container-content”).append(j);i.show(500);i=null});$(this.after(c);c.after(
);c=null}})}$(document.unload(函数(){$(“*”).unbind()});