时间:2021-07-01 10:21:17 帮助过:4人阅读
<%
String startTime = request.getParameter("startTime");
String endTime = request.getParameter("endTime");
String filter = request.getParameter("filter");
Charts charts = new Charts();
String start = startTime == null ? "2013-05-12" : startTime;
String end = endTime == null ? "2013-11-01" : endTime;
String filters = filter == null ? "eventtype" : filter;
JFreeChart chart = charts
.getPieChart(startTime, endTime, filter);//开始时间、结束时间、filter
String filename = ServletUtilities.saveChartAsJPEG(chart, 800, 400,
null, session);
FileOutputStream fos_jpg = null;
File file = new File(application.getRealPath("")+"/charts");
String path =request.getContextPath()+"/charts/NoData.jpg";
try {
file.mkdirs();
fos_jpg = new FileOutputStream(file.getPath()+"/"+filename);
ChartUtilities.writeChartAsJPEG(fos_jpg, 1.0f, chart, 800, 400,
null);
} catch (Exception e) {
} finally {
try {
fos_jpg.close();
} catch (Exception e) {
}
}
path = request.getContextPath()+"/charts/"+filename;
%>
实现导入JSP的JS源码
代码如下:
extjs.chart.chart3D = function(nodeid,id){
var panel = new Ext.Panel({
border:false,
fitToFrame: true,//很简单的就一个Html标签
html: ''
});
return panel;
}
http://www.bkjia.com/PHPjc/825020.htmlwww.bkjia.comtruehttp://www.bkjia.com/PHPjc/825020.htmlTechArticle如何在PHP上显示JFreechart?可能大部分都遇到这种情况,在JSP上的servlet能完全的显示出JFreechart画的统计图,但是和其他语言混合运用就不能显...