Commit acf88c86 authored by sbade's avatar sbade

added SSgrid implementaion of chart


git-svn-id: http://15.206.35.175/svn/proteus/business-java/trunk@97675 ce508802-f39f-4f6c-b175-0d175dae99d5
parent 5570da0c
......@@ -22,7 +22,6 @@ public class ChartCreator
String key = "";
String currentvalue = "";
String monthKey = null;
JSONObject graphJson = new JSONObject();
JSONObject categryJson = new JSONObject();
List<String> metaDataList = null;
......@@ -123,7 +122,6 @@ public class ChartCreator
}
//ended by swati on 22 dec 2014 for linkedchart
}
int cnt=0;
if (jsonObjGraph != null)
{
......@@ -139,19 +137,26 @@ public class ChartCreator
for (int jsnCnt = 0; jsnCnt < jsonObjFrGraph.size(); jsnCnt++)
{
JSONObject fetchRowWiseVal = (JSONObject) jsonObjFrGraph.get(String.valueOf(jsnCnt));
if(fetchRowWiseVal!=null)
{
for (int xCnt = 0; xCnt < xAxisColunList.size(); xCnt++)
{
if(fetchRowWiseVal.get(xAxisColunList.get(xCnt))!=null)
key = "" + fetchRowWiseVal.get(xAxisColunList.get(xCnt));
}
valueList = new ArrayList<String>();
for (int yCnt = 0; yCnt < yAxisColunList.size(); yCnt++)
{
if(fetchRowWiseVal.get(yAxisColunList.get(yCnt))!=null)
{
currentvalue = (fetchRowWiseVal.get(yAxisColunList.get(yCnt)).toString().replace('"', ' ').trim());
valueList.add(currentvalue);
}
}
allDataMap.put(key, valueList);
key = "";
}
}
valueMapSet = allDataMap.keySet();
if(chartTypeList.get(0).trim().equals("bar"))
{
......@@ -161,11 +166,13 @@ public class ChartCreator
categoryMap = new LinkedHashMap<JSONValue, JSONValue>();
keyString = keyString.replace('"', ' ').trim();
jsnStringValue = new JSONString(keyString);
jsnStringKey = new JSONString("label");
categoryMap.put(jsnStringKey, jsnStringValue);
labelList.add(categoryMap);
dataStringKey = new JSONString("value");
}
for (int seriesCnt = 0; seriesCnt < mapValuList.size(); seriesCnt++)
{
barMap = new LinkedHashMap<JSONValue, JSONValue>();
......@@ -178,6 +185,7 @@ public class ChartCreator
barChartMap = new LinkedHashMap<JSONValue, JSONValue>();
dataStringValue = new JSONString("" + mapValuList.get(seriesCnt));
barChartMap.put(dataStringKey, dataStringValue);
barChartMap.put(new JSONString("showValue"), new JSONString(showValList.get(seriesCnt)));
barValueList.add(barChartMap);
}
......@@ -206,7 +214,6 @@ public class ChartCreator
categryJson.put("category", categryDataVal);
graphJson.put("dataset", JSONParser.parseStrict(allDataList.toString().replace('=', ':')));
graphJson.put("categories", categryJson);
}
else if(chartTypeList.get(0).trim().equals("pie"))
{
......@@ -231,7 +238,6 @@ public class ChartCreator
}
}
if(chartTypeList.get(0).trim().equals("stack"))
{
HashMap<String, String> dMap = new HashMap<String, String>();
......@@ -259,7 +265,7 @@ public class ChartCreator
if(!barChartMap.containsKey(jsnStringKey))
{
barChartMap.put(dataStringKey, new JSONString(tempArr[1]));
//barChartMap.put(new JSONString("link"), new JSONString("n-/ibase/dwh/GwtDashboardPage.html?metadataname$pendingorder"));
//barChartMap.put(new JSONString("link"), new JSONString("#"));
}
}
if(! labelList.contains(categoryMap))
......@@ -277,7 +283,6 @@ public class ChartCreator
barMap.put(new JSONString("data"), barDataVal);
allDataList.add(barMap);
graphJson.put("dataset", JSONParser.parseStrict(allDataList.toString().replace('=', ':')));
}
categryDataVal = JSONParser.parseStrict(labelList.toString().replace('=', ':'));
categryJson.put("category", categryDataVal);
......@@ -290,6 +295,8 @@ public class ChartCreator
for (String keyString : valueMapSet)
{
mapValuList = allDataMap.get(keyString);
if(mapValuList.size()>0)
{
categoryMap = new LinkedHashMap<JSONValue, JSONValue>();
keyString = keyString.replace('"', ' ').trim();
jsnStringValue = new JSONString(keyString);
......@@ -297,6 +304,9 @@ public class ChartCreator
categoryMap.put(jsnStringKey, jsnStringValue);
labelList.add(categoryMap);
}
}
if(mapValuList.size()>0)
{
for (int seriesCnt = 0; seriesCnt < mapValuList.size(); seriesCnt++)
{
barMap = new LinkedHashMap<JSONValue, JSONValue>();
......@@ -324,35 +334,42 @@ public class ChartCreator
String prevUrl = temp.substring(temp.indexOf('&'), temp.length());
String period =FilterCreator.parameterList.get(1);
String url=Window.Location.getParameter("titleName");
//linkStringValue=new JSONString("P-detailsPopUp,"+linkedProperties+"-/ibase/dwh/GwtDashboardPage.html?metadataname$"+linkLMetadataList.get(seriesCnt)+"&"+xAxisColunList.get(0)+"$"+(""+jsnStringValue).replace('"', ' ').trim()+"&"+yAxisColunList.get(seriesCnt)+"$"+(""+dataStringValue).replace('"', ' ').trim());
String prdFilter="";
if(GWTDashBoardReport.prdFilterName.length()>0)
{
prdFilter=GWTDashBoardReport.prdFilterName;
}
if(url=="undefined" || url.equals("undefined") || url.equalsIgnoreCase("undefined"))
{
url="&titleName$"+(FilterCreator.title).get(0)+(""+jsnStringValue).replace('"', ' ').trim();
url="&titleName@"+(FilterCreator.title).get(0)+(""+jsnStringValue).replace('"', ' ').trim();
}
else
{
url="&titleName$"+url+":"+(FilterCreator.title).get(0)+(""+jsnStringValue).replace('"', ' ').trim();
url="&titleName@"+url+":"+(FilterCreator.title).get(0)+(""+jsnStringValue).replace('"', ' ').trim();
}
if((prevUrl).trim().length()>1)
{
if(linkTypeList.get(seriesCnt).trim().equalsIgnoreCase("n")){
linkStringValue=new JSONString(linkTypeList.get(seriesCnt)+"-"+"/ibase/dwh/GwtDashboardPage.html?metadataname$"+linkLMetadataList.get(seriesCnt)+prevUrl.replace('=', '$')+"&PRD_SALESDASH$"+period+url+"&"+yAxisColunList.get(seriesCnt)+"$"+(""+dataStringValue).replace('"', ' ').trim()+"&"+xAxisColunList.get(0)+"$"+(""+jsnStringValue).replace('"', ' ').trim());
}else if(linkTypeList.get(seriesCnt).trim().equalsIgnoreCase("p")){
linkStringValue=new JSONString(linkTypeList.get(seriesCnt)+"-detailsPopUp,"+linkedProperties+"-/ibase/dwh/GwtDashboardPage.html?metadataname$"+linkLMetadataList.get(seriesCnt)+prevUrl.replace('=', '$')+"&PRD_SALESDASH$"+period+url+"&"+yAxisColunList.get(seriesCnt)+"$"+(""+dataStringValue).replace('"', ' ').trim()+"&"+xAxisColunList.get(0)+"$"+(""+jsnStringValue).replace('"', ' ').trim());
if(linkTypeList.get(seriesCnt).trim().equalsIgnoreCase("n"))
{
linkStringValue=new JSONString(linkTypeList.get(seriesCnt)+"-"+"/ibase/dwh/GwtDashboardPage.html?metadataname@"+linkLMetadataList.get(seriesCnt)+prevUrl.replace('=', '@')+"&"+prdFilter+"@"+period+url+"&"+yAxisColunList.get(seriesCnt)+"@"+(""+dataStringValue).replace('"', ' ').trim()+"&"+xAxisColunList.get(0)+"@"+(""+jsnStringValue).replace('"', ' ').trim());
}
else if(linkTypeList.get(seriesCnt).trim().equalsIgnoreCase("p"))
{
linkStringValue=new JSONString(linkTypeList.get(seriesCnt)+"-detailsPopUp,"+linkedProperties+"-/ibase/dwh/GwtDashboardPage.html?metadataname@"+linkLMetadataList.get(seriesCnt)+prevUrl.replace('=', '@')+"&"+prdFilter+"@"+period+url+"&"+yAxisColunList.get(seriesCnt)+"@"+(""+dataStringValue).replace('"', ' ').trim()+"&"+xAxisColunList.get(0)+"@"+(""+jsnStringValue).replace('"', ' ').trim());
}
}
else
{
if(linkTypeList.get(seriesCnt).trim().equalsIgnoreCase("n")){
linkStringValue=new JSONString(linkTypeList.get(seriesCnt)+"-"+"/ibase/dwh/GwtDashboardPage.html?metadataname$"+linkLMetadataList.get(seriesCnt)+"&PRD_SALESDASH$"+period+url+"&"+yAxisColunList.get(seriesCnt)+"$"+(""+dataStringValue).replace('"', ' ').trim()+"&"+xAxisColunList.get(0)+"$"+(""+jsnStringValue).replace('"', ' ').trim());
if(linkTypeList.get(seriesCnt).trim().equalsIgnoreCase("n"))
{
linkStringValue=new JSONString(linkTypeList.get(seriesCnt)+"-"+"/ibase/dwh/GwtDashboardPage.html?metadataname@"+linkLMetadataList.get(seriesCnt)+"&"+prdFilter+"@"+period+url+"&"+yAxisColunList.get(seriesCnt)+"@"+(""+dataStringValue).replace('"', ' ').trim()+"&"+xAxisColunList.get(0)+"@"+(""+jsnStringValue).replace('"', ' ').trim());
}
else if(linkTypeList.get(seriesCnt).trim().equalsIgnoreCase("p")){
linkStringValue=new JSONString(linkTypeList.get(seriesCnt)+"-detailsPopUp,"+linkedProperties+"-/ibase/dwh/GwtDashboardPage.html?metadataname$"+linkLMetadataList.get(seriesCnt)+"&PRD_SALESDASH$"+period+url+"&"+yAxisColunList.get(seriesCnt)+"$"+(""+dataStringValue).replace('"', ' ').trim()+"&"+xAxisColunList.get(0)+"$"+(""+jsnStringValue).replace('"', ' ').trim());
linkStringValue=new JSONString(linkTypeList.get(seriesCnt)+"-detailsPopUp,"+linkedProperties+"-/ibase/dwh/GwtDashboardPage.html?metadataname@"+linkLMetadataList.get(seriesCnt)+"&"+prdFilter+"@"+period+url+"&"+yAxisColunList.get(seriesCnt)+"@"+(""+dataStringValue).replace('"', ' ').trim()+"&"+xAxisColunList.get(0)+"@"+(""+jsnStringValue).replace('"', ' ').trim());
}
}
barChartMap.put(linkStringKey, linkStringValue);
barChartMap.put(new JSONString("color"), new JSONString(colorInfoList.get(seriesCnt)));
//barChartMap.put(new JSONString("color"), new JSONString(colorInfoList.get(seriesCnt)));
barValueList.add(barChartMap);
}
barDataVal = JSONParser.parseStrict(barValueList.toString().replace('=', ':'));
......@@ -371,19 +388,42 @@ public class ChartCreator
{
barMap.put(new JSONString("valuePosition"), new JSONString("BELOW"));
}
barMap.put(new JSONString("color"), new JSONString(colorInfoList.get(seriesCnt)));
barMap.put(new JSONString("data"), barDataVal);
barMap.put(new JSONString("seriesname"), new JSONString(yAxisColumnName.get(seriesCnt)));
allDataList.add(barMap);
}
}
categryDataVal = JSONParser.parseStrict(labelList.toString().replace('=', ':'));
categryJson.put("category", categryDataVal);
graphJson.put("dataset", JSONParser.parseStrict(allDataList.toString().replace('=', ':')));
graphJson.put("categories", categryJson);
}
/**End of Linkedd chart logic by swati dates: 22 December 2014 **/
/**Start of Gantt chart logic by swati dated: 04 March 2014 **/
if(chartTypeList.get(0).trim().equals("ssgrid"))
{
for (String keyString : valueMapSet)
{
mapValuList = allDataMap.get(keyString);
if(mapValuList.size()>0)
{
categoryMap = new LinkedHashMap<JSONValue, JSONValue>();
keyString = keyString.replace('"', ' ').trim();
jsnStringValue = new JSONString(keyString);
jsnStringKey = new JSONString("label");
categoryMap.put(jsnStringKey, jsnStringValue);
categoryMap.put(new JSONString("value"), new JSONString("" + mapValuList.get(0)));
categoryMap.put(new JSONString("color"), new JSONString("" + mapValuList.get(1)));
labelList.add(categoryMap);
}
}
barDataVal = JSONParser.parseStrict(labelList.toString().replace('=', ':'));
graphJson.put("data", barDataVal);
}
/**End of Gantt chart logic by swati dated: 04 March 2014 **/
jsonChartVal = JSONParser.parseStrict(metaDataList.toString());
graphJson.put("chart", jsonChartVal);
......@@ -513,13 +553,8 @@ public class ChartCreator
trDataMap = new HashMap<String, List<String>>();
blDataMap = new HashMap<String, List<String>>();
brDataMap = new HashMap<String, List<String>>();
try
{
//metaDataMap=metaDataList.get(0);
jsonChartVal = JSONParser.parseStrict(metaDataList.get(0));
graphJson.put("chart", jsonChartVal);
......@@ -527,29 +562,20 @@ public class ChartCreator
for (int jsnCnt = 0; jsnCnt < jsonObjFrGraph.size(); jsnCnt++)
{
JSONObject fetchRowWiseVal = (JSONObject) jsonObjFrGraph.get(String.valueOf(jsnCnt));
for (int xCnt = 0; xCnt < rowIdList.size(); xCnt++)
{
key = "" + fetchRowWiseVal.get(rowIdList.get(xCnt));
}
valueList = new ArrayList<String>();
for (int yCnt = 0; yCnt < columnIdList.size(); yCnt++)
{
currentvalue = (fetchRowWiseVal.get(columnIdList.get(yCnt)).toString().replace('"', ' ').trim());
valueList.add(currentvalue);
}
allDataMap.put(key, valueList);
valueList = new ArrayList<String>();
for (int yCnt = 0; yCnt < columnIdList.size(); yCnt++)
{
/*Window.alert("fetchRowWiseVal.get(columnIdList.get(yCnt) is "+fetchRowWiseVal.get(tlLabelList.get(yCnt)));
Window.alert("fetchRowWiseVal.get(columnIdList.get(yCnt).toString().replace(', ' ').trim() "+fetchRowWiseVal.get(tlLabelList.get(yCnt).toString().replace('"', ' ').trim()));
*/
if(tlLabelList.get(yCnt).trim().length()!=0)
{
currentvalue = (fetchRowWiseVal.get(tlLabelList.get(yCnt)).toString().replace('"', ' ').trim());
......@@ -561,12 +587,9 @@ public class ChartCreator
valueList.add(currentvalue);
}
tlDataMap.put(key, valueList);
valueList = new ArrayList<String>();
for (int yCnt = 0; yCnt < columnIdList.size(); yCnt++)
{
//currentvalue = (fetchRowWiseVal.get(trLabelList.get(yCnt)).toString().replace('"', ' ').trim());
if(trLabelList.get(yCnt).trim().length()!=0)
{
currentvalue = (fetchRowWiseVal.get(trLabelList.get(yCnt)).toString().replace('"', ' ').trim());
......@@ -574,17 +597,12 @@ public class ChartCreator
{
currentvalue="";
}
valueList.add(currentvalue);
}
trDataMap.put(key, valueList);
//Window.alert("trDataMap is ="+trDataMap);
valueList = new ArrayList<String>();
for (int yCnt = 0; yCnt < columnIdList.size(); yCnt++)
{
//currentvalue = (fetchRowWiseVal.get(blLabelList.get(yCnt)).toString().replace('"', ' ').trim());
if(blLabelList.get(yCnt).trim().length()!=0)
{
currentvalue = (fetchRowWiseVal.get(blLabelList.get(yCnt)).toString().replace('"', ' ').trim());
......@@ -592,16 +610,12 @@ public class ChartCreator
{
currentvalue="";
}
valueList.add(currentvalue);
}
blDataMap.put(key, valueList);
valueList = new ArrayList<String>();
for (int yCnt = 0; yCnt < columnIdList.size(); yCnt++)
{
//currentvalue = (fetchRowWiseVal.get(brLabelList.get(yCnt)).toString().replace('"', ' ').trim());
if(brLabelList.get(yCnt).trim().length()!=0)
{
currentvalue = (fetchRowWiseVal.get(brLabelList.get(yCnt)).toString().replace('"', ' ').trim());
......@@ -614,8 +628,6 @@ public class ChartCreator
brDataMap.put(key, valueList);
key = "";
}
valueMapSet = allDataMap.keySet();
ArrayList<String> rowList =new ArrayList<String>();
for (String keyString : valueMapSet)
......@@ -624,13 +636,10 @@ public class ChartCreator
rowList.add(keyString);
rowDataJson = new LinkedHashMap<JSONString, JSONString>();
rowDataJson.put(new JSONString("id"),new JSONString(keyString));
rowDataList.add(rowDataJson.toString().replace('=', ':'));
}
rowJson.put("row", JSONParser.parseStrict(rowDataList.toString()));
graphJson.put("rows", JSONParser.parseStrict(rowJson.toString()));
for (int i = 0; i < columnNameList.size(); i++)
{
columnDataJson = new LinkedHashMap<JSONString, JSONString>();
......@@ -639,8 +648,6 @@ public class ChartCreator
}
columnJson.put("column", JSONParser.parseStrict(columnDataList.toString()));
graphJson.put("columns", JSONParser.parseStrict(columnJson.toString()));
mapSet = allDataMap.keySet();
for (String keyString : mapSet)
{
......@@ -668,24 +675,27 @@ public class ChartCreator
String period =FilterCreator.parameterList.get(1);
String url=Window.Location.getParameter("titleName");
/*add link code here 29 jan 2015*/
//linkStringValue=new JSONString("P-detailsPopUp,"+linkedProperties+"-/ibase/dwh/GwtDashboardPage.html?metadataname$"+linkLMetadataList.get(seriesCnt)+"&"+xAxisColunList.get(0)+"$"+(""+jsnStringValue).replace('"', ' ').trim()+"&"+yAxisColunList.get(seriesCnt)+"$"+(""+dataStringValue).replace('"', ' ').trim());
String prdFilter="";
if(GWTDashBoardReport.prdFilterName.length()>0)
{
prdFilter=GWTDashBoardReport.prdFilterName;
}
if(url=="undefined" || url.equals("undefined") || url.equalsIgnoreCase("undefined"))
{
url="&titleName$"+(FilterCreator.title).get(0)+(""+jsnStringValue).replace('"', ' ').trim();
url="&titleName@"+(FilterCreator.title).get(0)+(""+jsnStringValue).replace('"', ' ').trim();
}
else
{
url="&titleName$"+url+" : "+(FilterCreator.title).get(0)+(""+jsnStringValue).replace('"', ' ').trim();
url="&titleName@"+url+" : "+(FilterCreator.title).get(0)+(""+jsnStringValue).replace('"', ' ').trim();
}
url = url.replace("\\", " ");
if((prevUrl).trim().length()>1)
{
linkStringValue=new JSONString("n-"+"/ibase/dwh/GwtDashboardPage.html?metadataname$"+linkedMetadataList.get(i)+prevUrl.replace('=', '$')+"&PRD_SALESDASH$"+period+url+"&"+rowIdList.get(0)+"$"+((""+jsnStringValue).replace("\\", " ")).replace('"', ' ').trim()+"&"+keyString.replace('"', ' ').trim()+"$"+(""+dataStringValue).replace('"', ' ').trim());
linkStringValue=new JSONString("n-"+"/ibase/dwh/GwtDashboardPage.html?metadataname@"+linkedMetadataList.get(i)+prevUrl.replace('=', '@')+"&"+prdFilter+"@"+period+url+"&"+rowIdList.get(0)+"@"+((""+jsnStringValue).replace("\\", " ")).replace('"', ' ').trim()+"&"+keyString.replace('"', ' ').trim()+"@"+(""+dataStringValue).replace('"', ' ').trim());
}
else
{
linkStringValue=new JSONString("n-"+"/ibase/dwh/GwtDashboardPage.html?metadataname$"+linkedMetadataList.get(i)+"&PRD_SALESDASH$"+period+url+"&"+rowIdList.get(0)+"$"+((""+jsnStringValue).replace("\\", " ")).replace('"', ' ').trim()+"&"+keyString.replace('"', ' ').trim()+"$"+(""+dataStringValue).replace('"', ' ').trim());
linkStringValue=new JSONString("n-"+"/ibase/dwh/GwtDashboardPage.html?metadataname@"+linkedMetadataList.get(i)+"&"+prdFilter+"@"+period+url+"&"+rowIdList.get(0)+"@"+((""+jsnStringValue).replace("\\", " ")).replace('"', ' ').trim()+"&"+keyString.replace('"', ' ').trim()+"@"+(""+dataStringValue).replace('"', ' ').trim());
}
dataJson.put(new JSONString("link"),linkStringValue);
/*end link code here 29 jan 2015*/
......@@ -693,7 +703,6 @@ public class ChartCreator
}
}
dataSetJson.put("data", JSONParser.parseStrict(dataList.toString()));
dataSetList.add(dataSetJson.toString().replace('=', ':'));
graphJson.put("dataset", JSONParser.parseStrict(dataSetList.toString()));
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment