后台页面:
List<Map<String, String>> list = saleService.getSaleAndBuyer(); StringBuffer dateArray = new StringBuffer(); StringBuffer saleArray = new StringBuffer(); StringBuffer buyerArray = new StringBuffer(); dateArray.append("["); saleArray.append("["); buyerArray.append("["); for (int i=0;i<list.size();i++) { dateArray.append(list.get(i).get("date")); //数据格式的转换 saleArray.append(String.valueOf(list.get(i).get("salePrice"))); buyerArray.append(String.valueOf(list.get(i).get("buyerCount"))); if (i < list.size()-1) { dateArray.append(","); saleArray.append(","); buyerArray.append(","); } } dateArray.append("]"); saleArray.append("]"); buyerArray.append("]"); request.setAttribute("dateArray", dateArray); request.setAttribute("saleArray", saleArray); request.setAttribute("buyerArray", buyerArray); logger.warn("登录成功"); return "/stock/success";
前台页面:
1、BigDemical 与String之间的转换
2、前后台的取值之后是否是所需要的,不是所需再转换
附:highcharts使用文档地址:https://www.hcharts.cn/docs/basic-chart