Commit 5d2db576 authored by sbade's avatar sbade

added code for linked chart graph


git-svn-id: http://15.206.35.175/svn/proteus/business-java/trunk@97096 ce508802-f39f-4f6c-b175-0d175dae99d5
parent e12442dc
...@@ -52,7 +52,13 @@ public class ChartCreator ...@@ -52,7 +52,13 @@ public class ChartCreator
ArrayList<LinkedHashMap<JSONValue, JSONValue>> labelList = null; ArrayList<LinkedHashMap<JSONValue, JSONValue>> labelList = null;
ArrayList<LinkedHashMap<JSONValue, JSONValue>> barValueList = null; ArrayList<LinkedHashMap<JSONValue, JSONValue>> barValueList = null;
ArrayList<LinkedHashMap<JSONValue, JSONValue>> allDataList = null; ArrayList<LinkedHashMap<JSONValue, JSONValue>> allDataList = null;
//added by swati on 22 dec 2014 for linkedchart
JSONString linkStringKey = null;
JSONString linkStringValue = null;
List<String> linkLMetadataList = new ArrayList<String>();
List<String> linkTypeList = new ArrayList<String>();
String linkedProperties="";
// ended by swati on 22 dec 2014 for linkedchart
for (int i = 0; i < graphDtlList.size(); i++) for (int i = 0; i < graphDtlList.size(); i++)
{ {
if (i == 3) if (i == 3)
...@@ -99,7 +105,20 @@ public class ChartCreator ...@@ -99,7 +105,20 @@ public class ChartCreator
{ {
chartTypeList = (ArrayList<String>) graphDtlList.get(i); chartTypeList = (ArrayList<String>) graphDtlList.get(i);
} }
//added by swati on 22 dec 2014 for -- linkedchart metadataname/properties
if (i == 14)
{
linkLMetadataList = (ArrayList<String>)graphDtlList.get(i);
}
if (i == 15)
{
linkedProperties = ""+graphDtlList.get(i);
}
if (i == 16)
{
linkTypeList = (ArrayList<String>)graphDtlList.get(i);
}
//ended by swati on 22 dec 2014 for linkedchart
} }
int cnt=0; int cnt=0;
if (jsonObjGraph != null) if (jsonObjGraph != null)
...@@ -183,7 +202,8 @@ public class ChartCreator ...@@ -183,7 +202,8 @@ public class ChartCreator
categryDataVal = JSONParser.parseStrict(labelList.toString().replace('=', ':')); categryDataVal = JSONParser.parseStrict(labelList.toString().replace('=', ':'));
categryJson.put("category", categryDataVal); categryJson.put("category", categryDataVal);
graphJson.put("dataset", JSONParser.parseStrict(allDataList.toString().replace('=', ':'))); graphJson.put("dataset", JSONParser.parseStrict(allDataList.toString().replace('=', ':')));
graphJson.put("categories", categryJson); graphJson.put("categories", categryJson);
} }
else if(chartTypeList.get(0).trim().equals("pie")) else if(chartTypeList.get(0).trim().equals("pie"))
{ {
...@@ -258,10 +278,104 @@ public class ChartCreator ...@@ -258,10 +278,104 @@ public class ChartCreator
categryDataVal = JSONParser.parseStrict(labelList.toString().replace('=', ':')); categryDataVal = JSONParser.parseStrict(labelList.toString().replace('=', ':'));
categryJson.put("category", categryDataVal); categryJson.put("category", categryDataVal);
graphJson.put("categories", categryJson); graphJson.put("categories", categryJson);
} }
/**Start of Linked chart logic by swati dates: 22 December 2014 **/
if(chartTypeList.get(0).trim().equals("linkedchart"))
{
for (String keyString : valueMapSet)
{
mapValuList = allDataMap.get(keyString);
categoryMap = new LinkedHashMap<JSONValue, JSONValue>();
keyString = keyString.replace('"', ' ').trim();
jsnStringValue = new JSONString(keyString);
jsnStringKey = new JSONString("label");
categoryMap.put(jsnStringKey, jsnStringValue);
labelList.add(categoryMap);
}
for (int seriesCnt = 0; seriesCnt < mapValuList.size(); seriesCnt++)
{
barMap = new LinkedHashMap<JSONValue, JSONValue>();
barValueList = new ArrayList<LinkedHashMap<JSONValue, JSONValue>>();
array = valueMapSet.toArray();
for (int columnCnt = 0; columnCnt < array.length; columnCnt++)
{
/*start of new code by swati on 23 dec 2014*/
String keyString = ""+array[columnCnt];
barChartMap = new LinkedHashMap<JSONValue, JSONValue>();
keyString = keyString.replace('"', ' ').trim();
jsnStringValue = new JSONString(keyString);
jsnStringKey = new JSONString("label");
dataStringKey = new JSONString("value");
/*end of new code by swati on 23 dec 2014*/
monthKey = (String) array[columnCnt];
mapValuList = allDataMap.get(monthKey);
dataStringValue = new JSONString("" + mapValuList.get(seriesCnt));
barChartMap.put(dataStringKey, dataStringValue);
barChartMap.put(new JSONString("showValue"), new JSONString(showValList.get(seriesCnt)));
linkStringKey = new JSONString("link");
String temp = Window.Location.getHref();
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());
if(url=="undefined" || url.equals("undefined") || url.equalsIgnoreCase("undefined"))
{
url="&titleName$"+(FilterCreator.title).get(0)+(""+jsnStringValue).replace('"', ' ').trim();
}
else{
url="&titleName$"+url+":"+(FilterCreator.title).get(0)+(""+jsnStringValue).replace('"', ' ').trim();
}
if((prevUrl).trim().length()>1)
{
linkStringValue=new JSONString("n-"+"/ibase/dwh/GwtDashboardPage.html?metadataname$"+linkLMetadataList.get(seriesCnt)+prevUrl.replace('=', '$')+"&PRD_CODE$"+period+url+"&"+yAxisColunList.get(seriesCnt)+"$"+(""+dataStringValue).replace('"', ' ').trim()+"&"+xAxisColunList.get(0)+"$"+(""+jsnStringValue).replace('"', ' ').trim());
}
else
{
linkStringValue=new JSONString("n-"+"/ibase/dwh/GwtDashboardPage.html?metadataname$"+linkLMetadataList.get(seriesCnt)+"&PRD_CODE$"+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)));
barValueList.add(barChartMap);
}
barDataVal = JSONParser.parseStrict(barValueList.toString().replace('=', ':'));
if ("column".equals(renderInfoList.get(seriesCnt)))
{
barMap.put(new JSONString("renderas"), new JSONString("Column"));
barMap.put(new JSONString("parentYAxis"), new JSONString("s"));
}
if ("line".equals(renderInfoList.get(seriesCnt)))
{
barMap.put(new JSONString("renderas"), new JSONString("Line"));
barMap.put(new JSONString("parentYAxis"), new JSONString("s"));
barMap.put(new JSONString("valuePosition"), new JSONString("ABOVE"));
}
else
{
barMap.put(new JSONString("valuePosition"), new JSONString("BELOW"));
}
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);
/* start for color of data value - style property is added by swati on 06jan2015 */
/* start for color of data value - style property is added by swati on 06jan2015 */
}
/**End of Linkedd chart logic by swati dates: 22 December 2014 **/
jsonChartVal = JSONParser.parseStrict(metaDataList.toString()); jsonChartVal = JSONParser.parseStrict(metaDataList.toString());
graphJson.put("chart", jsonChartVal); graphJson.put("chart", jsonChartVal);
//Window.alert("graphJson:"+graphJson);
} catch (Exception e) } catch (Exception e)
{ {
......
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