Javascript 如何向jqPlot条形图添加代码在jsp中单击按钮时另存为图像
我在jsp中显示了一个jqPlot条形图。现在我看到了一个按钮单击选项,可以将图表视为图像并将其保存到图像中,但我不知道如何实现这一点。。 我添加了按钮代码 这是我的密码Javascript 如何向jqPlot条形图添加代码在jsp中单击按钮时另存为图像,javascript,jquery,jsp,jqplot,Javascript,Jquery,Jsp,Jqplot,我在jsp中显示了一个jqPlot条形图。现在我看到了一个按钮单击选项,可以将图表视为图像并将其保存到图像中,但我不知道如何实现这一点。。 我添加了按钮代码 这是我的密码 <script type="text/javascript"> $(document).ready(function(){ $.jqplot.config.enablePlugins = true; var s1 = [200, 600, 700,
<script type="text/javascript">
$(document).ready(function(){
$.jqplot.config.enablePlugins = true;
var s1 = [200, 600, 700, 1000,1400];
var ticks = ['Local', 'STD', 'ISD', 'INET','Incoming'];
plot1 = $.jqplot('chart1', [s1], {
// Only animate if we're not using excanvas (not in IE 7 or IE 8)..
animate: !$.jqplot.use_excanvas,
seriesDefaults:{
renderer:$.jqplot.BarRenderer,
pointLabels: { show: true }
},
axes: {
xaxis: {
renderer: $.jqplot.CategoryAxisRenderer,
ticks: ticks
}
},
highlighter: { show: true }
});
$('#chart1').bind('jqplotDataClick',
function (ev, seriesIndex, pointIndex, data) {
$('#info1').html('series: '+seriesIndex+', point: '+pointIndex+', data: '+data);
}
);
});
</script>
</head>
<body>
<br/>
<br/>
<input type="submit" name="ViewImage" id="view" value="ViewImage">
<div name="chart1" id="chart1" value="chart1" style="height: 300px;width: 400px;left: 100px">
</body>
$(文档).ready(函数(){
$.jqplot.config.enablePlugins=true;
变量s1=[20060070010001400];
var ticks=['Local'、'STD'、'ISD'、'INET'、'Incoming'];
plot1=$.jqplot('chart1',[s1]{
//只有在我们不使用excanvas(不在IE7或IE8中)时才进行动画制作。。
动画:!$.jqplot.use_excanvas,
系列默认值:{
渲染器:$.jqplot.blunderer,
点标签:{show:true}
},
轴线:{
xaxis:{
渲染器:$.jqplot.CategoryAxisRenderer,
滴答声:滴答声
}
},
荧光灯:{show:true}
});
$(“#图表1”).bind('jqplotDataClick',
函数(ev、序列索引、点索引、数据){
$('info1').html('series:'+seriesIndex+',point:'+pointIndex+',data:'+data');
}
);
});
任何帮助都将不胜感激
提前感谢。不要使用输入,请使用按钮 其功能是:
$("#div_ID').jqplotSaveImage();
以下是你问题的答案:[[1]: