diff options
author | Indrijeet kumar <indriku1@in.ibm.com> | 2020-05-18 10:08:40 +0530 |
---|---|---|
committer | Indrijeet kumar <indriku1@in.ibm.com> | 2020-05-18 10:08:46 +0530 |
commit | 82a329bb42823abebc04706e3477f50acf35343f (patch) | |
tree | 4ce69740b929f0cd326e631da537da5630d2dbf5 /ecomp-sdk | |
parent | e1dce346175ec18962e8687479da76b59ca75ab2 (diff) |
removed unwanted codes in ChartD3Helper
removed unwanted codes in ChartD3Helper
Issue-ID: PORTAL-813
Change-Id: I8fe16c45f54bb2072667aec9629c11dd6134f6ca
Signed-off-by: Indrijeet Kumar <indriku1@in.ibm.com>
Diffstat (limited to 'ecomp-sdk')
-rw-r--r-- | ecomp-sdk/epsdk-analytics/src/main/java/org/onap/portalsdk/analytics/model/runtime/ChartD3Helper.java | 104 |
1 files changed, 10 insertions, 94 deletions
diff --git a/ecomp-sdk/epsdk-analytics/src/main/java/org/onap/portalsdk/analytics/model/runtime/ChartD3Helper.java b/ecomp-sdk/epsdk-analytics/src/main/java/org/onap/portalsdk/analytics/model/runtime/ChartD3Helper.java index 72769e3f..b780062c 100644 --- a/ecomp-sdk/epsdk-analytics/src/main/java/org/onap/portalsdk/analytics/model/runtime/ChartD3Helper.java +++ b/ecomp-sdk/epsdk-analytics/src/main/java/org/onap/portalsdk/analytics/model/runtime/ChartD3Helper.java @@ -278,13 +278,11 @@ public class ChartD3Helper { } } - //Object uniqueElements [] = ts.toArray(); - //SortedSet s = Collections.synchronizedSortedSet(ts); uniqueElements = ts.toArray(); } else { DataColumnType dct = null; List yTextSeries = reportRuntime.getChartDisplayNamesList(AppConstants.CHART_ALL_COLUMNS, formValues); - //if(columnValuesList.size() == 1) { + for (Iterator iter = l.iterator(); iter.hasNext();) { dct = (DataColumnType) iter.next(); @@ -307,19 +305,10 @@ public class ChartD3Helper { chartLeftAxisLabel = (chartLeftAxisLabel.indexOf("|")!=-1)?chartLeftAxisLabel.substring(0,chartLeftAxisLabel.indexOf("|")):""; } columnMap.put(dct.getDisplayName(), dct.getColId()); - /* - ts.add(dct.getDisplayName()); - if(nvl(chartLeftAxisLabel).length()<=0) { - chartLeftAxisLabel = nvl(dct.getYAxis()); - chartLeftAxisLabel = (chartLeftAxisLabel.indexOf("|")!=-1)?chartLeftAxisLabel.substring(0,chartLeftAxisLabel.indexOf("|")):""; - } - columnMap.put(dct.getDisplayName(), dct.getColId()); - */ } } } - //SortedSet s = Collections.synchronizedSortedSet(ts); uniqueElements = ts.toArray(); } @@ -373,13 +362,10 @@ public class ChartD3Helper { wholeScript.append("<script src=\""+ chartScriptsPath +"d3/js/tooltip.js\"></script> \n"); wholeScript.append("<script src=\""+ chartScriptsPath +"d3/js/utils.js\"></script> \n"); wholeScript.append("<script src=\""+ chartScriptsPath +"d3/js/models/axis.min.js\"></script> \n"); - //wholeScript.append("<script src=\""+ AppUtils.getBaseFolderURL() +"d3/js/models/discreteBar.js\"></script> \n"); - //wholeScript.append("<script src=\""+ AppUtils.getBaseFolderURL() +"d3/js/models/discreteBarChart.js\"></script> \n"); wholeScript.append("<script src=\""+ chartScriptsPath +"d3/js/models/multiChart.js\"></script> \n"); //json wholeScript.append("<script> \n"); wholeScript.append("historicalBarChart = [ \n"); - //wholeScript.append("{ \n"); // data ArrayList dataSeries = new ArrayList(); @@ -453,7 +439,6 @@ public class ChartD3Helper { //continue; flagNoDate = 1; int pos = 0; - //if(!((String)uniqueElementsList.get(i)).equals(dateStr)) { for (int f=0 ; f< uniqueXAxisElements.length; f++) { if(uniqueXAxisElements[f].equals(dateStr)){ pos = f ; @@ -462,10 +447,9 @@ public class ChartD3Helper { } dateStrList.add("'"+dateStr+"'"); - //uniqueElement = (String)uniqueElements[j]; try { YAXISNUM = Integer.parseInt(ds.getString(i, columnMap.get((hasCustomizedChartColor?(uniqueElement.indexOf("|")!=-1?uniqueElement.substring(0, uniqueElement.indexOf("|")):uniqueElement):uniqueElement)))); - //if(MAXNUM < YAXISNUM) MAXNUM = YAXISNUM; + if(MAXDOUBLENUM < YAXISNUM) MAXDOUBLENUM = YAXISNUM; } catch (NumberFormatException ex) { @@ -571,7 +555,6 @@ public class ChartD3Helper { //continue; flagNoDate = 1; int pos = 0; - //if(!((String)uniqueElementsList.get(i)).equals(dateStr)) { for (int f=0 ; f< uniqueXAxisElements.length; f++) { if(uniqueXAxisElements[f].equals(dateStr)){ pos = f ; @@ -622,7 +605,6 @@ public class ChartD3Helper { } dataSeriesOverAllMap.put(uniqueElements[j], dataSeriesStrMap); } else { - //date = MMDDYYYYFormat.parse(ds.getString(i, 1), new ParsePosition(0)); if(!barRealTimeAxis) { // true - non-time if(!dateStrList.contains(new Long(date.getTime()).toString())) { dateStrList.add(new Long(date.getTime()).toString()); @@ -652,8 +634,6 @@ public class ChartD3Helper { //flagNull = 1; } - //if(ds.getString(i, 2).equals(uniqueElements[j])) { - // dateStrList.add("'"+dateStr+"'"); HashMap<String, String> dataMap = dataSeriesMap.get((String) uniqueElements[j]); if(logScale) { dataMap.put(date.getTime()+"", (flagNull == 0 ? (YAXISDOUBLENUM>0?new Double(Math.log10(YAXISDOUBLENUM)).toString():new Double(Math.log10(new Double(YAXISNUM>0?YAXISNUM:1).doubleValue())).toString()): "null")); @@ -662,9 +642,7 @@ public class ChartD3Helper { dataMap.remove(date.getTime()); } dataMap.put(date.getTime()+"", (flagNull == 0 ? (YAXISDOUBLENUM>0?new Double(YAXISDOUBLENUM).toString():new Integer(YAXISNUM).toString()): "null")); - //System.out - // .println(dataMap + " " + dataSeriesMap); - //} + } } else if (AppUtils.nvl(ds.getString(i, 2)).length()<=0) { @@ -681,7 +659,6 @@ public class ChartD3Helper { } } } - // dataSeriesOverAllMap.put(uniqueElements[j], dataSeriesMap); } } @@ -719,19 +696,13 @@ public class ChartD3Helper { Long endDate = Long.parseLong((String) dateElements[dateElements.length-1]); java.util.Date date1 = null; //first value - date1 = new java.util.Date(initialDate.longValue()); - /* DateFormat formatter = new SimpleDateFormat("MM/dd/yyyy HH:mm:ss Z"); - System.out.println(formatter.format(new java.util.Date(initialDate.longValue()))); - */ //initialDate = initialDate + HOUR; - + date1 = new java.util.Date(initialDate.longValue()); dateStrBuf.append(initialDate+","); sortSet.add(""+initialDate); // DateUtils. while ( initialDate <= endDate) { - //System.out.println("********** " + df.format(initialDate)); - //date1 = new java.util.Date(initialDate.longValue() * 1000); date1 = new java.util.Date(initialDate.longValue()); if(formatFlag==HOURFLAG) date1 = DateUtils.addHours(date1, 1); @@ -749,13 +720,7 @@ public class ChartD3Helper { dateStrBuf.append(initialDate+","); sortSet.add(""+initialDate); } - //DateUtils.addHours(date1, 1); - } - //DateFormat df = DateFormat.getDateTimeInstance(DateFormat.FULL, DateFormat.FULL); - //df.setTimeZone(TimeZone.getTimeZone("UTC")); - //java.util.Date date1 = new java.util.Date(initialDate.longValue() * 1000); - //java.util.Date d = df. - //for () + } } } dateStrBuf.deleteCharAt(dateStrBuf.length()-1); @@ -1230,16 +1195,7 @@ public class ChartD3Helper { } } - /*StringBuffer dataSeries1 = new StringBuffer(""); - dataSeries1.append(" { key: \"Series1\",values: ["); - StringBuffer dataSeries2 = new StringBuffer(""); - dataSeries2.append(" { key: \"Series2\", values: ["); - StringBuffer dataSeries3 = new StringBuffer(""); - dataSeries3.append(" { key: \"Series3\", values: ["); - */ - - //long minTime = 1000000000000000L; int MAXNUM = 0; double MAXDOUBLENUM = 0.0; int YAXISNUM = 0; @@ -1449,17 +1405,9 @@ public class ChartD3Helper { } } - // ((StringBuffer) dataSeries.get(j)).append ("{ \"x\":" + minTime + " , \"y\":" + 0 +"}, "); } -/* if(ds.getString(i, 2).equals("Series1")) { - dataSeries1.append("[ " + date.getTime() + " , " + ds.getString(i, 3) +"], "); - } else if (ds.getString(i, 2).equals("Series2")) { - dataSeries2.append("[ " + date.getTime() + " , " + ds.getString(i, 3) +"], "); - } else if (ds.getString(i, 2).equals("Series3")) { - dataSeries3.append("[ " + date.getTime() + " , " + ds.getString(i, 3) +"], "); - } -*/ } + } for (int i = 0; i < uniqueRevElements.length; i++) { StringBuffer strBuf = ((StringBuffer) dataSeries.get(i)); @@ -1475,10 +1423,8 @@ public class ChartD3Helper { for (int i = 0; i < uniqueRevElements.length; i++) { wholeScript.append((StringBuffer)dataSeries.get(i)); } -/* wholeScript.append(dataSeries1); - wholeScript.append(dataSeries2); - wholeScript.append(dataSeries3); -*/ wholeScript.append("];\n"); + + wholeScript.append("];\n"); /* Sorting is commented out.*/ StringBuffer dateStrBuf = new StringBuffer(""); @@ -1911,12 +1857,7 @@ public class ChartD3Helper { columnValues.add(AppUtils.nvls(ds.getString(i, columnIndex), "null")); } } -/* actual = ds.getString(i, "actual"); - //forecast = ds.getString(i, "forecast"); - upperBound = ds.getString(i, "upperBound"); - lowerBound = ds.getString(i, "lowerBound"); - -*/ if(!timeCharts) + if(!timeCharts) anomalyText = ds.getString(i, "anomaly_text"); //dataStrBuf.append(" [new Date(moment(\""+dateStr+"\")),"+ actual /*+","+ forecast*/+","+ lowerBound +","+ upperBound +"],\n"); dataStrBuf.append(" [new Date(moment(\""+dateStr+"\"))"); @@ -1952,9 +1893,7 @@ public class ChartD3Helper { } } - - //if(!timeCharts) - //anomalyRec = anomalyRec - 1; + minDate = maxDate - (new Long(reportRuntime.getZoomIn()).longValue()*60*60*1000); System.out.println(new java.util.Date(maxDate) + " " + new java.util.Date(minDate) + " " + reportRuntime.getZoomIn()); @@ -1965,7 +1904,6 @@ public class ChartD3Helper { wholeScript.append("<!DOCTYPE html>\n"); wholeScript.append("<html>\n"); wholeScript.append(" <head>\n"); - //wholeScript.append("<meta http-equiv=\"X-UA-Compatible\" content=\"IE=EmulateIE7; IE=EmulateIE9\">\n"); wholeScript.append("<meta http-equiv=\"X-UA-Compatible\" content=\"IE=edge\" />\n"); wholeScript.append("<script type=\"text/javascript\" src=\""+ chartScriptsPath +"dy3/js/dygraph-combined.js\"></script>\n"); wholeScript.append("<script type=\"text/javascript\" src=\""+ chartScriptsPath +"dy3/js/moment.min.js\"></script>\n"); @@ -2185,8 +2123,6 @@ public class ChartD3Helper { if(!timeCharts) { wholeScript.append(" function nameAnnotation(ann) { \n"); wholeScript.append(" return ann.shortText; \n"); - //wholeScript.append(" var m = moment(ann.x);\n"); - //wholeScript.append(" return \"(\" + ann.series + \", \" + m.format(\"YYYY-MM-DD HH\"); + \")\"; \n"); wholeScript.append(" }\n"); wholeScript.append(" anns = [];\n"); } @@ -2195,9 +2131,6 @@ public class ChartD3Helper { wholeScript.append(" g = new Dygraph(\n"); wholeScript.append(" document.getElementById(\"div_g"+reportRuntime.getReportID()+"\"),\n"); //data here - /*wholeScript.append(" [\n"); - wholeScript.append(dataStrBuf.toString()); - wholeScript.append(" ],\n");*/ wholeScript.append(" data , \n"); wholeScript.append(" {\n"); @@ -2242,16 +2175,8 @@ public class ChartD3Helper { wholeScript.append(" var minutes = d.getMinutes();\n"); wholeScript.append(" var seconds = d.getSeconds();\n"); wholeScript.append(" var wholeString = Dygraph.zeropad(month)+'/'+Dygraph.zeropad(day);\n"); - // wholeScript.append(" if(hour >= 0 && minutes > 0 && seconds > 0) {\n"); - //wholeScript.append(" wholeString += ' ' + Dygraph.zeropad(hour) + ':'+Dygraph.zeropad(minutes)+':'+Dygraph.zeropad(seconds);\n"); - //wholeScript.append(" } else if (hour >= 0 && minutes > 0 && seconds == 0) {\n"); if(AppUtils.nvl(reportRuntime.getTimeAxisType()).length()==0 || AppUtils.nvl(reportRuntime.getTimeAxisType()).equals("hourly")) wholeScript.append(" wholeString += ' ' + Dygraph.zeropad(hour) + ':'+Dygraph.zeropad(minutes);\n"); - //wholeScript.append(" } else if (hour >= 0 && (minutes >= 0 && seconds > 0)) {\n"); - //wholeScript.append(" wholeString += ' ' + Dygraph.zeropad(hour) + ':'+Dygraph.zeropad(minutes)+':'+Dygraph.zeropad(seconds);\n"); - //wholeScript.append(" } else if (hour >= 0) { \n"); - //wholeScript.append(" wholeString += ' ' + Dygraph.zeropad(hour); \n"); - //wholeScript.append(" } \n"); wholeScript.append(" return wholeString; \n"); wholeScript.append(" },\n"); wholeScript.append(" ticker: function (a, b, pixels, opts, dygraph, vals) { \n "); @@ -2280,15 +2205,6 @@ public class ChartD3Helper { wholeScript.append(" touchstart : newDygraphTouchstart,\n"); wholeScript.append(" touchend : Dygraph.defaultInteractionModel.touchend,\n"); wholeScript.append(" touchmove : Dygraph.defaultInteractionModel.touchmove\n"); - //wholeScript.append(" 'dblclick' : dblClickV3,\n"); - //wholeScript.append(" 'mousewheel' : scrollV3\n"); - - /*wholeScript.append(" 'mousedown' : downV3,\n"); - wholeScript.append(" 'mousemove' : moveV3,\n"); - wholeScript.append(" 'mouseup' : upV3,\n"); - wholeScript.append(" 'click' : clickV3,\n"); - wholeScript.append(" 'dblclick' : dblClickV3,\n"); - wholeScript.append(" 'mousewheel' : scrollV3\n");*/ wholeScript.append("},\n"); /*wholeScript.append(" zoomCallback: function(minDate, maxDate, yRanges) { \n"); if(AppUtils.nvl(reportRuntime.getTimeAxisType()).equals("daily")) { |