最新下载
热门教程
- 1
- 2
- 3
- 4
- 5
- 6
- 7
- 8
- 9
- 10
echarts+java封装类实现图表的实例
时间:2022-11-14 23:25:47 编辑:袖梨 来源:一聚教程网
介绍了一个基于.net封装的echarts类,今天分享一下:echarts+java封装类实现图表的demo。
1、echarts封装类:
package com.ffcs.wlan.model;
import java.util.ArrayList;
import java.util.List;
public class EchartData {
public List
public List
public List
public EchartData(List
super();
this.legend = legendList;
this.category = categoryList;
this.series = seriesList;
}
}
package com.ffcs.wlan.model;
import java.util.List;
public class Series {
public String name;
public String type;
public List
public Series( String name, String type, List
super();
this.name = name;
this.type = type;
this.data = data;
}
}
上面是Series 类。
2、控制器实现
package com.ffcs.wlan.controller;
import java.util.ArrayList;
import java.util.Arrays;
import java.util.List;
import org.slf4j.Logger;
import org.slf4j.LoggerFactory;
import org.springframework.stereotype.Controller;
import org.springframework.web.bind.annotation.RequestMapping;
import org.springframework.web.bind.annotation.ResponseBody;
import com.ffcs.wlan.model.EchartData;
import com.ffcs.wlan.model.Series;
@Controller
@RequestMapping("/echarts")
public class EntityController {
private static final Logger logger = LoggerFactory.getLogger(EntityController.class);
@RequestMapping("/line_data")
@ResponseBody
public EchartData lineData() {
logger.info("lineData....");
List
List
List
series.add(new Series("最高气温", "line",
new ArrayList
21,23,28,26,21,33,44))));
EchartData data=new EchartData(legend, category, series);
return data;
}
@RequestMapping("/line_page")
public String linePage() {
logger.info("linePage....");
return "report/line";
}
}
3、jsp页面代码:
<%@ page language="java" import="java.util.*" pageEncoding="UTF-8"%>
注意路径${pageContext.request.contextPath}!
相关文章
- 《无限暖暖》围巾蚯蚓具体作用介绍 12-24
- 《无限暖暖》星夜守望连衣裙获得方法介绍 12-24
- 《无限暖暖》魔物试炼幻境解锁方法介绍 12-24
- 《无限暖暖》磐岩晶石获得方法介绍 12-24
- 《无限暖暖》巨石岩仔打法攻略分享 12-24
- 《无限暖暖》布布果在哪 12-24