<dependency>
<groupId>org.apache.httpcomponents</groupId>
<artifactId>httpclient</artifactId>
<version>4.5.13</version>
</dependency>
#### 3.java代码部分
###### 1.将下载的js文件的完整路径定义成常量,方便使用(注意不同环境,存放的位置可能不同,需要进行修改)
//windows
private static final String JSpath = "F:/openSource/echars/echarts-convert/echarts-convert1.js";
//linux
//private static final String JSpath = "/usr/local/echars/echarts-convert/echarts-convert1.js";
###### 2.根据Echars生成图片的方法(这里的循环是为了将线条数据进行组装)
public String createPngByEchars(List<Map<String, Object>> lines, Map<String, Object> property) throws Exception {
MetricsMonitor metricsMonitor = new MetricsMonitor();
List<List> list = new ArrayList<>();
for (Map<String, Object> line : lines) {
List<Map<String, Object>> valueData = (List<Map<String, Object>>) line.get("valueData");
List<PmsMetricsMonitorIndexVO> monitorIndexVOList = new ArrayList<>();
for (Map<String, Object> map : valueData) {
PmsMetricsMonitorIndexVO vo = new PmsMetricsMonitorIndexVO();
vo.setCurrentTimeStr(map.get("watchTime").toString());
if (map.get("value") == null) {
vo.setTechDeliDura(null);
} else {
vo.setTechDeliDura(new BigDecimal(map.get("value").toString()));