第一步:导入js,顺序不能变,否则显示不出来
第二部:后台采用spring MVC
@RequestMapping("/test2") public String test2(ModelMap map,String scoreType) { Date date = new Date(); String format = DateUtil.format(date, DateUtil.DATE).substring(0, 7); Listlist = ScoreServiceImpl.getdetailScoreForYear(format.substring(0,4),scoreType); List yaer = new ArrayList (); List sumScore = new ArrayList (); List count = new ArrayList (); for (int i = 0; i < list.size(); i++) { yaer.add("'"+list.get(i).getsDdate()+"'"); sumScore.add(list.get(i).getSumscore()); count.add(list.get(i).getCount()); } map.put("year", yaer);//集合传输到前台为json格式 map.put("sumScore", sumScore); map.put("count", count); return "gbs/scorecount/yearcount"; }
第三部:前台