Commit d0ae8a97 authored by dkasliwal's avatar dkasliwal

Add smart Filter selected value parameter in buildChartData method and pass to...

Add smart Filter selected value parameter in buildChartData method and pass to the drill down level dashboard. and check JSON String is null condition in bubble chart method.


git-svn-id: http://15.206.35.175/svn/proteus/business-java/trunk@104630 ce508802-f39f-4f6c-b175-0d175dae99d5
parent aa6dd083
......@@ -4,6 +4,7 @@ import java.util.ArrayList;
import java.util.HashMap;
import java.util.LinkedHashMap;
import java.util.List;
import java.util.Map;
import java.util.Set;
......@@ -19,7 +20,7 @@ import com.google.gwt.xml.client.XMLParser;
public class ChartCreator
{
public static JSONObject buildChartData(ArrayList<ArrayList<String>> graphDtlList, JSONObject jsonObjGraph, String dataSource,ArrayList<String> parameterList,ArrayList<FilterInfo> filterList, String currentID)
public static JSONObject buildChartData(ArrayList<ArrayList<String>> graphDtlList, JSONObject jsonObjGraph, String dataSource,ArrayList<String> parameterList,ArrayList<FilterInfo> filterList, String currentID,HashMap<String, ArrayList<String>> selectedDataMap)
{
String key = "";
String currentvalue = "";
......@@ -189,6 +190,32 @@ public class ChartCreator
toolTextDataList = new ArrayList<String>();
samePageOpenContainer = new SamePageOpenContainer();
/*Added code for create Str of smart filter parameter by Dhanendra on date 06-01-2017*/
String smartFilterParameterStr = "";
if(selectedDataMap!=null)
{
for(Map.Entry<String, ArrayList<String>> entry:selectedDataMap.entrySet())
{
String colName = entry.getKey();
ArrayList<String> colValueList = selectedDataMap.get(colName);
String smtFilterParameterStrTemp = null;
for(String value:colValueList)
{
CommonUtils.printOnConsole("value :"+value);
if(smtFilterParameterStrTemp==null)
{
smtFilterParameterStrTemp = value;
}else
{
smtFilterParameterStrTemp = smtFilterParameterStrTemp+"," +value;
}
}
smartFilterParameterStr =smartFilterParameterStr+"&"+(colName+"@"+smtFilterParameterStrTemp);
}
CommonUtils.printOnConsole("smartFilterParameterStr :"+smartFilterParameterStr);
}
/*Ended code for create Str of smart filter parameter by Dhanendra on date 06-01-2017*/
for (FilterInfo filterInfo : filterList)
{
......@@ -615,6 +642,10 @@ public class ChartCreator
}
cnt1++;
}
propertyStr = propertyStr + smartFilterParameterStr;
CommonUtils.printOnConsole("******* propertyStr ******* :"+propertyStr);
if(prdFilterName.length()>0)
{
prdFilter=prdFilterName;
......@@ -1638,89 +1669,96 @@ public class ChartCreator
public static JSONObject getBubbleChart(ArrayList<ArrayList<String>> graphDtlList, JSONObject jsonObjGraph, String dataSource)
{
JSONObject bubbleChartJson = new JSONObject();
JSONObject jsonObjFrGraph = (JSONObject) jsonObjGraph.get(dataSource);
ArrayList<String> dataList = new ArrayList<String>();
ArrayList<String> labelList = new ArrayList<String>();
ArrayList<LinkedHashMap<JSONValue, JSONValue>> allDataList = null;
ArrayList<LinkedHashMap<JSONValue, String>> dataListMap = null;
LinkedHashMap<JSONValue, String> dataMap = null;
LinkedHashMap<JSONValue, JSONValue> datasetMap = null;
JSONObject fetchRowWiseVal = null;
String data = "";
for (int i = 0; i < graphDtlList.size(); i++)
if(jsonObjGraph!=null)
{
if (i == 7)
{
labelList = (ArrayList<String>) graphDtlList.get(i);
}
if (i == 8)
{
dataList = (ArrayList<String>) graphDtlList.get(i);
}
}
dataListMap = new ArrayList<LinkedHashMap<JSONValue,String>>();
allDataList = new ArrayList<LinkedHashMap<JSONValue,JSONValue>>();
CommonUtils.printOnConsole("labelList :"+labelList);
CommonUtils.printOnConsole("dataList :"+dataList);
for (int jsnCnt = 0; jsnCnt < jsonObjFrGraph.size(); jsnCnt++)
{
dataMap = new LinkedHashMap<JSONValue, String>();
datasetMap = new LinkedHashMap<JSONValue, JSONValue>();
dataListMap = new ArrayList<LinkedHashMap<JSONValue,String>>();
fetchRowWiseVal = (JSONObject) jsonObjFrGraph.get(String.valueOf(jsnCnt));
for (String lblName : labelList)
JSONObject jsonObjFrGraph = (JSONObject) jsonObjGraph.get(dataSource);
ArrayList<String> dataList = new ArrayList<String>();
ArrayList<String> labelList = new ArrayList<String>();
ArrayList<LinkedHashMap<JSONValue, JSONValue>> allDataList = null;
ArrayList<LinkedHashMap<JSONValue, String>> dataListMap = null;
LinkedHashMap<JSONValue, String> dataMap = null;
LinkedHashMap<JSONValue, JSONValue> datasetMap = null;
JSONObject fetchRowWiseVal = null;
String data = "";
for (int i = 0; i < graphDtlList.size(); i++)
{
CommonUtils.printOnConsole("lblName :"+lblName);
data = fetchRowWiseVal.get(lblName).toString().replace('"', ' ');
if (data.trim().length() != 0)
if (i == 7)
{
datasetMap.put(new JSONString("label"),fetchRowWiseVal.get(lblName));
int r = (int)(Math.random() * 255);
int g = (int)(Math.random() * 255);
int b = (int)(Math.random() * 255);
String rgba = "rgba("+r+","+g+","+b+",0.9)";
String rgb = "rgb("+r+","+g+","+b+")";
datasetMap.put(new JSONString("backgroundColor"),new JSONString(rgba));
datasetMap.put(new JSONString("borderColor"),new JSONString(rgb));
datasetMap.put(new JSONString("hoverBackgroundColor"),new JSONString(rgb));
datasetMap.put(new JSONString("borderWidth"),new JSONString("1"));
labelList = (ArrayList<String>) graphDtlList.get(i);
}
if (i == 8)
{
dataList = (ArrayList<String>) graphDtlList.get(i);
}
}
//for (String idName : dataList)
for (int i = 0; i < dataList.size(); i++)
dataListMap = new ArrayList<LinkedHashMap<JSONValue,String>>();
allDataList = new ArrayList<LinkedHashMap<JSONValue,JSONValue>>();
CommonUtils.printOnConsole("labelList :"+labelList);
CommonUtils.printOnConsole("dataList :"+dataList);
for (int jsnCnt = 0; jsnCnt < jsonObjFrGraph.size(); jsnCnt++)
{
CommonUtils.printOnConsole("idName :"+dataList.get(i));
data = fetchRowWiseVal.get(dataList.get(i)).toString().replace('"', ' ');
if (data.trim().length() != 0)
dataMap = new LinkedHashMap<JSONValue, String>();
datasetMap = new LinkedHashMap<JSONValue, JSONValue>();
dataListMap = new ArrayList<LinkedHashMap<JSONValue,String>>();
fetchRowWiseVal = (JSONObject) jsonObjFrGraph.get(String.valueOf(jsnCnt));
for (String lblName : labelList)
{
if(i == 0)
{
dataMap.put(new JSONString("x"),fetchRowWiseVal.get(dataList.get(i)).toString().replace('"', ' '));
}
if(i == 1)
CommonUtils.printOnConsole("lblName :"+lblName);
data = fetchRowWiseVal.get(lblName).toString().replace('"', ' ');
if (data.trim().length() != 0)
{
dataMap.put(new JSONString("y"),fetchRowWiseVal.get(dataList.get(i)).toString().replace('"', ' '));
datasetMap.put(new JSONString("label"),fetchRowWiseVal.get(lblName));
int r = (int)(Math.random() * 255);
int g = (int)(Math.random() * 255);
int b = (int)(Math.random() * 255);
String rgba = "rgba("+r+","+g+","+b+",0.9)";
String rgb = "rgb("+r+","+g+","+b+")";
datasetMap.put(new JSONString("backgroundColor"),new JSONString(rgba));
datasetMap.put(new JSONString("borderColor"),new JSONString(rgb));
datasetMap.put(new JSONString("hoverBackgroundColor"),new JSONString(rgb));
datasetMap.put(new JSONString("borderWidth"),new JSONString("1"));
}
if(i == 2)
}
//for (String idName : dataList)
for (int i = 0; i < dataList.size(); i++)
{
CommonUtils.printOnConsole("idName :"+dataList.get(i));
data = fetchRowWiseVal.get(dataList.get(i)).toString().replace('"', ' ');
if (data.trim().length() != 0)
{
dataMap.put(new JSONString("r"),fetchRowWiseVal.get(dataList.get(i)).toString().replace('"', ' '));
if(i == 0)
{
dataMap.put(new JSONString("x"),fetchRowWiseVal.get(dataList.get(i)).toString().replace('"', ' '));
}
if(i == 1)
{
dataMap.put(new JSONString("y"),fetchRowWiseVal.get(dataList.get(i)).toString().replace('"', ' '));
}
if(i == 2)
{
dataMap.put(new JSONString("r"),fetchRowWiseVal.get(dataList.get(i)).toString().replace('"', ' '));
}
}
}
dataListMap.add(dataMap);
datasetMap.put(new JSONString("data"), JSONParser.parseStrict(dataListMap.toString().replace('=', ':')));
allDataList.add(datasetMap);
}
dataListMap.add(dataMap);
datasetMap.put(new JSONString("data"), JSONParser.parseStrict(dataListMap.toString().replace('=', ':')));
allDataList.add(datasetMap);
bubbleChartJson.put("datasets", JSONParser.parseStrict(allDataList.toString().replace('=', ':')));
}
bubbleChartJson.put("datasets", JSONParser.parseStrict(allDataList.toString().replace('=', ':')));
return bubbleChartJson;
}
......
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