Search in sources :

Example 21 with DateRangeScoreVO

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++;
                // ----------------------------------------------------------------------
                }
            }
        }
    }
}
Also used : ObjectiveVO(com.netsteadfast.greenstep.vo.ObjectiveVO) HashMap(java.util.HashMap) LinkedHashMap(java.util.LinkedHashMap) KpiVO(com.netsteadfast.greenstep.vo.KpiVO) DateRangeScoreVO(com.netsteadfast.greenstep.vo.DateRangeScoreVO) PerspectiveVO(com.netsteadfast.greenstep.vo.PerspectiveVO) VisionVO(com.netsteadfast.greenstep.vo.VisionVO) LinkedList(java.util.LinkedList) List(java.util.List) LinkedList(java.util.LinkedList)

Aggregations

DateRangeScoreVO (com.netsteadfast.greenstep.vo.DateRangeScoreVO)21 BbMeasureData (com.netsteadfast.greenstep.po.hbm.BbMeasureData)9 KpiVO (com.netsteadfast.greenstep.vo.KpiVO)9 BscMeasureData (com.netsteadfast.greenstep.bsc.model.BscMeasureData)8 ObjectiveVO (com.netsteadfast.greenstep.vo.ObjectiveVO)8 PerspectiveVO (com.netsteadfast.greenstep.vo.PerspectiveVO)8 HashMap (java.util.HashMap)5 Cell (org.apache.poi.ss.usermodel.Cell)4 Row (org.apache.poi.ss.usermodel.Row)4 XSSFCellStyle (org.apache.poi.xssf.usermodel.XSSFCellStyle)4 XSSFColor (org.apache.poi.xssf.usermodel.XSSFColor)4 XSSFFont (org.apache.poi.xssf.usermodel.XSSFFont)4 Phrase (com.itextpdf.text.Phrase)3 PdfPCell (com.itextpdf.text.pdf.PdfPCell)3 ArrayList (java.util.ArrayList)3 LinkedList (java.util.LinkedList)3 CellRangeAddress (org.apache.poi.ss.util.CellRangeAddress)3 BbTsaMaCoefficients (com.netsteadfast.greenstep.po.hbm.BbTsaMaCoefficients)2 List (java.util.List)2 Image (com.itextpdf.text.Image)1