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就是百分比的值,这样饼图就出不来了 求高手指点下。