答案:图显IP:
只要从数据库中读取数据出来,然后循环记录,把数据填入jfreechart中的数据集就可以啦!
ds = this.getDataSource(request,"ds");
conn = ds.getConnection();
ReportInfoBean infoBean = CommonUtil.getReportInfo(conn, SysConfig.REPORT_TYPE_LIVEDENSITY);
String sqlParam = "";
if(sels == null || sels.equals("")){
sqlParam = infoBean.getControlCamIDs();
}else{
sqlParam = sels;
}
url = SysConfig.WEB_APPNAME_PATH+"reportLiveDensityAction.do?method=toSearchRecord&begintime="+beginTime+"&endtime="+endTime+"&sels="+sels;
projectName = infoBean.getProjectName();
dataOper.setCon(conn);
String sql = "exec Sp_PeopleDensity '"
+userInfo.getUserID()+"'," //用户ID
+"'','"//工程ID
+beginTime+"','"//开始日期
+endTime+"','"//结束日期
+"00:"+infoBean.getXinterval()+":00"+"',"//时间间隔
+infoBean.getMultiple()+","//倍数
+"0"+","//0表示所有出入口,1表示部分出入口(此参数在该存储过程中暂无用)
+infoBean.getAlarmNum()+","//警戒线
+"'"+sqlParam+"'";//镜头号
System.out.println("sql="+sql);
ReportChartFactory factory = new ReportChartFactory();
List list = dataOper.queryToList(sql);
factory.generateLiveDensityMap(list);
JFreeChart jfreechart = factory.createLiveDensityChart(factory.createLiveDensityDataset(list,confBean),infoBean,confBean);
ChartRenderingInfo info = new ChartRenderingInfo(new StandardEntityCollection());
ChartUtilities.saveChartAsJPEG(new File(filePath+fileName),jfreechart,width,height,info);//宽1000,高600
useMapStr = ChartUtilities.getImageMap(fileName,info);
useMapStr = factory.replaceImageMap(useMapStr);
其他:只能从前端向后端取,不能让数据库通知数据集自己更新,数据库去自己更新数据集
上一个:mysql,通过phpmyadmin导出数据库时,选项:"处理事务中封装输出","禁止选定不相关的主键"是什么意思?
下一个:mysql 5.1.55版本下建的数据库,导入到5.0版本上,会有不兼容吗?