use of com.netsteadfast.greenstep.vo.DateRangeScoreVO in project bamboobsc by billchen198318.
the class KpiReportContentQueryAction method fillLineChartData.
private void fillLineChartData(BscStructTreeObj treeObj) throws Exception {
// 給 09 - Dashboard 用的 , 判斷 用第1筆的資料來組 categories 的變數
int c = 0;
List<VisionVO> visions = treeObj.getVisions();
for (VisionVO vision : visions) {
if (!vision.getOid().equals(this.getFields().get("visionOid"))) {
continue;
}
// 在 Dashboard 查詢時, 一定要選 vision, 所以只會有一個 vision , 給 09 - Dashboard 用的
this.subTitle = vision.getTitle();
for (PerspectiveVO perspective : vision.getPerspectives()) {
// 給 04 - Perspectives Dashboard 用的
this.perspectiveItems.add(perspective);
for (ObjectiveVO objective : perspective.getObjectives()) {
for (KpiVO kpi : objective.getKpis()) {
Map<String, String> labelMap = new HashMap<String, String>();
List<List<Object>> dataList = new LinkedList<List<Object>>();
labelMap.put("label", kpi.getName());
this.lineChartNames.add(labelMap);
for (DateRangeScoreVO entry : kpi.getDateRangeScores()) {
List<Object> dateScoreList = new LinkedList<Object>();
dateScoreList.add(entry.getDate().replaceAll("/", "-"));
dateScoreList.add(entry.getScore());
dataList.add(dateScoreList);
}
this.lineChartValues.add(dataList);
// ----------------------------------------------------------------------
// 給 09 - Dashboard 用的
// 給 Dashboard 頁面 trend line chart 用的資料
Map<String, Object> mapData = new HashMap<String, Object>();
List<Float> rangeScore = new LinkedList<Float>();
for (DateRangeScoreVO dateRangeScore : kpi.getDateRangeScores()) {
if (c == 0) {
// 用第1筆的資料來組 categories 就可已了
categories.add(dateRangeScore.getDate());
}
rangeScore.add(dateRangeScore.getScore());
}
mapData.put("name", kpi.getName());
mapData.put("data", rangeScore);
this.series.add(mapData);
c++;
// ----------------------------------------------------------------------
}
}
}
}
}
Aggregations