Commit c065672e authored by dkasliwal's avatar dkasliwal

Sum for y-axis coloum for detail level json string


git-svn-id: http://15.206.35.175/svn/proteus/business-java/trunk@104933 ce508802-f39f-4f6c-b175-0d175dae99d5
parent 2ecf4dcd
...@@ -190,12 +190,10 @@ public class ChartCreator ...@@ -190,12 +190,10 @@ public class ChartCreator
if (i == 26) if (i == 26)
{ {
subTitleColunList = (ArrayList<String>)graphDtlList.get(i); subTitleColunList = (ArrayList<String>)graphDtlList.get(i);
CommonUtils.printOnConsole("zAxisColunList :"+subTitleColunList);
} }
if (i == 27) if (i == 27)
{ {
subTitleColumnName = (ArrayList<String>)graphDtlList.get(i); subTitleColumnName = (ArrayList<String>)graphDtlList.get(i);
CommonUtils.printOnConsole("zAxisColumnName :"+subTitleColumnName);
} }
/* if (i == 28) /* if (i == 28)
{ {
...@@ -256,29 +254,74 @@ public class ChartCreator ...@@ -256,29 +254,74 @@ public class ChartCreator
try try
{ {
JSONObject jsonObjFrGraph =(JSONObject) jsonObjGraph.get(dataSource); JSONObject jsonObjFrGraph =(JSONObject) jsonObjGraph.get(dataSource);
String prvKey = "";
//HashMap<String, List<String>> allDataMapTemp = new HashMap<String, List<String>>();
ArrayList<String> valueListTemp = new ArrayList<String>();
double valueTemp = 0.0;
for (int jsnCnt = 0; jsnCnt < jsonObjFrGraph.size(); jsnCnt++) for (int jsnCnt = 0; jsnCnt < jsonObjFrGraph.size(); jsnCnt++)
{ {
JSONObject fetchRowWiseVal = (JSONObject) jsonObjFrGraph.get(String.valueOf(jsnCnt)); JSONObject fetchRowWiseVal = (JSONObject) jsonObjFrGraph.get(String.valueOf(jsnCnt));
if(fetchRowWiseVal!=null) if(fetchRowWiseVal!=null)
{ {
for (int xCnt = 0; xCnt < xAxisColunList.size(); xCnt++) for (int xCnt = 0; xCnt < xAxisColunList.size(); xCnt++)
{ {
key = "";
if(fetchRowWiseVal.get(xAxisColunList.get(xCnt))!=null) if(fetchRowWiseVal.get(xAxisColunList.get(xCnt))!=null)
key = "" + fetchRowWiseVal.get(xAxisColunList.get(xCnt)); key = "" + fetchRowWiseVal.get(xAxisColunList.get(xCnt));
} }
valueList = new ArrayList<String>(); /*valueList = new ArrayList<String>();
for (int yCnt = 0; yCnt < yAxisColunList.size(); yCnt++) for (int yCnt = 0; yCnt < yAxisColunList.size(); yCnt++)
{ {
if(fetchRowWiseVal.get(yAxisColunList.get(yCnt))!=null) if(fetchRowWiseVal.get(yAxisColunList.get(yCnt))!=null)
{ {
currentvalue = (fetchRowWiseVal.get(yAxisColunList.get(yCnt)).toString().replace('"', ' ').trim()); currentvalue = (fetchRowWiseVal.get(yAxisColunList.get(yCnt)).toString().replace('"', ' ').trim());
valueList.add(currentvalue); valueList.add(currentvalue);
} }
} }
allDataMap.put(key, valueList); allDataMap.put(key, valueList);*/
key = ""; //key = "";
/*Add code for detail level JSON String and sum for y-axis coloum*/
if(!prvKey.equalsIgnoreCase(key))
{
//CommonUtils.printOnConsole("********** In IF **********");
valueListTemp = 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());
valueListTemp.add(currentvalue);
}
}
allDataMap.put(key, valueListTemp);
valueTemp = 0.0;
}else
{
//CommonUtils.printOnConsole("********** In else **********");
List<String> valueListTemp1 = new ArrayList<String>();
valueListTemp = new ArrayList<String>();
//CommonUtils.printOnConsole("allDataMapTemp.get(key) :"+allDataMapTemp.get(key));
valueListTemp1 = allDataMap.get(key);
//CommonUtils.printOnConsole("valueListTemp1 :"+valueListTemp1);
valueTemp = 0.0;
for (int yCnt = 0; yCnt < yAxisColunList.size(); yCnt++)
{
if(fetchRowWiseVal.get(yAxisColunList.get(yCnt))!=null)
{
currentvalue = (fetchRowWiseVal.get(yAxisColunList.get(yCnt)).toString().replace('"', ' ').trim());
valueTemp = Double.parseDouble(valueListTemp1.get(yCnt)) + Double.parseDouble(currentvalue);
valueListTemp.add(""+valueTemp);
}
}
//CommonUtils.printOnConsole("After add valueListTemp :"+valueListTemp);
allDataMap.put(key, valueListTemp);
}
/*End code for detail level JSON String and sum for y-axis coloum*/
/*Add code for Tooltext By Dhanendra on 30/06/15 */ /*Add code for Tooltext By Dhanendra on 30/06/15 */
for (int count = 0; count < toolTextList.size(); count++) for (int count = 0; count < toolTextList.size(); count++)
{ {
...@@ -292,8 +335,11 @@ public class ChartCreator ...@@ -292,8 +335,11 @@ public class ChartCreator
} }
} }
/*End code for Tooltext By Dhanendra on 30/06/15 */ /*End code for Tooltext By Dhanendra on 30/06/15 */
prvKey = key;
} }
} }
CommonUtils.printOnConsole("allDataMap :"+allDataMap);
valueMapSet = allDataMap.keySet(); valueMapSet = allDataMap.keySet();
if(chartTypeList.get(0).trim().equals("bar")) if(chartTypeList.get(0).trim().equals("bar"))
......
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