废话不多说,直接上代码:
一、定义一个后台数据保存类:
public class BarDTO<T>{
private String name;
private String type;
private List<T> data;
public String getName() {
return name;
}
public void setName(String name) {
this.name = name;
}
public String getType() {
return type;
}
public void setType(String type) {
this.type = type;
}
public List<T> getData() {
return data;
}
public void setData(List<T> data) {
this.data = data;
}
}
public String getTimeChar(){
Map<String, BarDTO<Double>> map = new HashMap<String,BarDTO<Double>>();// 柱状图数据
List<Double> inCosts = new ArrayList<Double>(); //投入成本
List<Double> outCosts = new ArrayList<Double>(); //产出成本
List<Double> profits = new ArrayList<Do