public void SendmmSStatusCodeAnalysis() { String cityId = this.getParameter("cityId");
String time1 = this.getParameter("startTime"); statslevel = "43200";
String startTime = "";
String endTime = ""; startTime = time1 + "000000";
endTime = time1 + "312359"; List rsltLst = null;
try {
rsltLst = terminalPerformanceService
.getPerformanceMmsBySendstatusCode(cityId, startTime,
endTime, statslevel);
} catch (ServiceException e) {
try {
this.getResponse().getWriter().write("查询异常");
} catch (IOException e1) {
e1.printStackTrace();
}
e.printStackTrace();
} if (rsltLst != null && !rsltLst.isEmpty()) {
Iterator itr = rsltLst.iterator(); Document document = DocumentHelper.createDocument();
Element rootEl = document.addElement("chart");
Element el = null;
HashMap rsMap = null;
String statusCode = "";
String mmsCnt = "";
String percent = "";
while (itr.hasNext()) {
rsMap = (HashMap) itr.next();
statusCode = (String) rsMap.get("statusCode");
mmsCnt = (String) rsMap.get("mmsCnt");
percent = (String) rsMap.get("percent");
el = rootEl.addElement("set");
el.addAttribute("label", statusCode);
el.addAttribute("value", mmsCnt); }
// rootEl.addAttribute("caption", "用户品牌占比");
Element styleEl = rootEl.addElement("styles");
el = styleEl.addElement("definition");
el = el.addElement("style");
el.addAttribute("name", "dataLabeStyle");
el.addAttribute("type", "font");
el.addAttribute("size", "12");
// el.addAttribute("font", "宋体");
el.addAttribute("color", "#009900"); el = styleEl.addElement("application");
el = el.addElement("apply");
el.addAttribute("toObject", "DataLabels");
el.addAttribute("styles", "dataLabeStyle"); // log.info("\n" + document.asXML()); try {
this.getResponse().getWriter().write(document.asXML());
} catch (IOException e) {
e.printStackTrace();
}
} else {
try {
this.getResponse().getWriter().write("没有查询到数据");
} catch (IOException e) {
e.printStackTrace();
}
} }
这是我统计出一个饼图的JAVA代码,其中 el.addAttribute("value", mmsCnt); 就是饼图里面的值,显示的是数字。但现在要求显示百分比,但我写成el.addAttribute("value", percent); //percent就是百分比的值,这样饼图就出不来了 求高手指点下。
String time1 = this.getParameter("startTime"); statslevel = "43200";
String startTime = "";
String endTime = ""; startTime = time1 + "000000";
endTime = time1 + "312359"; List rsltLst = null;
try {
rsltLst = terminalPerformanceService
.getPerformanceMmsBySendstatusCode(cityId, startTime,
endTime, statslevel);
} catch (ServiceException e) {
try {
this.getResponse().getWriter().write("查询异常");
} catch (IOException e1) {
e1.printStackTrace();
}
e.printStackTrace();
} if (rsltLst != null && !rsltLst.isEmpty()) {
Iterator itr = rsltLst.iterator(); Document document = DocumentHelper.createDocument();
Element rootEl = document.addElement("chart");
Element el = null;
HashMap rsMap = null;
String statusCode = "";
String mmsCnt = "";
String percent = "";
while (itr.hasNext()) {
rsMap = (HashMap) itr.next();
statusCode = (String) rsMap.get("statusCode");
mmsCnt = (String) rsMap.get("mmsCnt");
percent = (String) rsMap.get("percent");
el = rootEl.addElement("set");
el.addAttribute("label", statusCode);
el.addAttribute("value", mmsCnt); }
// rootEl.addAttribute("caption", "用户品牌占比");
Element styleEl = rootEl.addElement("styles");
el = styleEl.addElement("definition");
el = el.addElement("style");
el.addAttribute("name", "dataLabeStyle");
el.addAttribute("type", "font");
el.addAttribute("size", "12");
// el.addAttribute("font", "宋体");
el.addAttribute("color", "#009900"); el = styleEl.addElement("application");
el = el.addElement("apply");
el.addAttribute("toObject", "DataLabels");
el.addAttribute("styles", "dataLabeStyle"); // log.info("\n" + document.asXML()); try {
this.getResponse().getWriter().write(document.asXML());
} catch (IOException e) {
e.printStackTrace();
}
} else {
try {
this.getResponse().getWriter().write("没有查询到数据");
} catch (IOException e) {
e.printStackTrace();
}
} }
这是我统计出一个饼图的JAVA代码,其中 el.addAttribute("value", mmsCnt); 就是饼图里面的值,显示的是数字。但现在要求显示百分比,但我写成el.addAttribute("value", percent); //percent就是百分比的值,这样饼图就出不来了 求高手指点下。
解决方案 »
- sql ,hql 如何实现多个条件查询自由动态拼接
- 求助:struts2类型转化的问题
- JAVA如何全程追踪项目然后打印到文本文件,急
- struts2中怎么这样求不出购物车中所以商品的总价?
- 用过installanywhere的进来帮下忙
- strutstest213-1.2_2.4只支持struts1.1,不支持struts1.3.5,还有别的测试工具吗?
- 兄弟们我要崩溃了!!!java导入海量数据到excel出错
- hibernate托管转持久,update,saveOrUpdate方法问题
- >琴声刺骨<--当我埋头于JSP,EJB,STRUTS的时候,她在...分多无用,散!进来有分!
- 在AIX4.3.3上安装jdk131,但..
- 工作5.5年,大专,java开发,想去淘宝是否可能,面试都需要特殊准备什么?谢谢高手解答,此贴一定结!
- java经纬度取热门范围
其中设置这个参数(showPercentValues="1")就行了。不是直接给他的值一个百分数,它会自动计算的。