}
uniqueElement = (String)uniqueElements[j];
if(date==null) {
- //continue;
+ //continue
flagNoDate = 1;
int pos = 0;
for (int f=0 ; f< uniqueXAxisElements.length; f++) {
} catch (NumberFormatException ex1) {
flagNull = 1;
}
- //flagNull = 1;
}
/* For Non-date type value enclose with double quotes */
flagNull = 1;
}
- //flagNull = 1;
}
HashMap<String, String> dataMap = dataSeriesMap.get((String) uniqueElements[j]);
if(logScale) {
}
- //}
}
}
for(int kI = 0; kI < uniqueElements.length; kI++) {
YAXISNUM = 0;
YAXISDOUBLENUM = 0.0;
flagNull= 0;
- //flagSecondNull = 0;
dateStr = ds.getString(i, 1);
if(timeAxis) {
date = getDateFromDateStr(dateStr);
}
uniqueElement = (String)uniqueElements[j];
if(date==null) {
- //continue;
+ //continue
flagNoDate = 1;
int pos = 0;
for (int f=0 ; f< uniqueXAxisElements.length; f++) {
flagNull = 1;
}
- //flagNull = 1;
}
if(logScale) {
flagNull = 1;
}
- //flagNull = 1;
}
HashMap<String, String> dataMap = dataSeriesMap.get((String) uniqueElements[j]);
}
if(timeAxis) {
- //if(!barRealTimeAxis) { // false - non-time
Object[] dateAllElements = (Object[]) sortSet.toArray();
for (int i = 0; i < uniqueElements.length; i++) {
HashMap<String, String> dataMap = dataSeriesMap.get((String)uniqueElements[i]);
for (int j=0; j<dateAllElements.length;j++) {
- //if(strBuf.toString().indexOf((String) dateAllElements[j]) == -1) {
if(!dataMap.containsKey((String) dateAllElements[j])) {
dataMap.put((String) dateAllElements[j], "null");
}
}
}
- //}
}
String valueStr = "";
for (int i = 0; i < uniqueElements.length; i++) {
wholeScript.append("nv.addGraph(function() { \n");
if(horizontalBar /*&& flagNoDate == 1*/)
wholeScript.append(" chart = nv.models.multiBarHorizontalChart() \n");
- else /*if (flagNoDate == 1)*/
+ else
wholeScript.append(" chart = nv.models.multiBarChart() \n");
- /*else
- wholeScript.append(" var chart = nv.models.multiBarTimeSeriesChart() \n");*/
wholeScript.append(" .margin({top: "+ topMargin +", right: "+ rightMargin +", bottom: "+ bottomMargin +", left: " + leftMargin +"}) \n");
if(showLegend) {
wholeScript.append(" .reduceXTicks(true) \n ");
else if (!horizontalBar) {
wholeScript.append(" .reduceXTicks(false) \n ");
- //wholeScript.append(" chart.lines1.forceY(["+(nvl(reportRuntime.getRangeAxisLowerLimit()).length()<=0?"0":reportRuntime.getRangeAxisLowerLimit()) +", "+ (nvl(reportRuntime.getRangeAxisUpperLimit()).length()<=0?UPPER_RANGE:reportRuntime.getRangeAxisUpperLimit()) + "]); \n" +
double UPPER_RANGE = 0;
if(Math.ceil((MAXDOUBLENUM+(MAXDOUBLENUM*25/100))/100) * 100 >= 1) {
UPPER_RANGE = Math.ceil(MAXDOUBLENUM+(MAXDOUBLENUM*25/100));
}
if(nvl(chartRightAxisLabel).length() > 0) {
- //if(flagNoDate == 1)
wholeScript.append(" chart.yAxis\n");
- //else
- // wholeScript.append(" chart.yAxis1\n");
if(logScale) {
wholeScript.append(" .logScale(true)\n ");
} else {
wholeScript.append(" .axisLabel('" + chartLeftAxisLabel + "') \n" +
" .tickFormat(d3.format(',.0f')); \n");
- /*" chart.yAxis2\n " +
- " .axisLabel('" + chartRightAxisLabel + "') \n" +
- " .tickFormat(d3.format(',.0f')); \n");*/
} else {
- //if(flagNoDate == 1)
wholeScript.append(" chart.yAxis\n");
- //else
- // wholeScript.append(" chart.yAxis1\n");
if(logScale) {
wholeScript.append(" .logScale(true)\n ");
} else {
wholeScript.append(" .tickFormat(d3.format(',."+MAXNUMDECIMALPLACES+"f')); \n");
else
wholeScript.append(" .tickFormat(d3.format(',." + precision + "f')); \n");
- //" .tickFormat(d3.format(',.0f')); \n");
}
wholeScript.append(" d3.select('#chart"+reportRuntime.getReportID()+" svg') \n" +
" .datum(historicalBarChart) \n" );
"return chart; \n" +
"}); \n");
wholeScript.append("function redraw() { \n");
- //wholeScript.append(" nv.utils.windowResize(chart.update); \n");
wholeScript.append(" d3.select('#chart"+reportRuntime.getReportID()+" svg') \n") ;
wholeScript.append(" .datum(historicalBarChart) \n");
wholeScript.append(" .transition().duration(500) \n");
int flag = 0;
flag = hasCategoryAxis?1:0;
String uniqueElements [] = null;
- //TreeSet ts = new TreeSet();
ArrayList ts = new ArrayList<String>();
HashMap<String, String> columnMap = new HashMap();
//check timeAxis
catStr.append("|"+color);
}
} catch (ArrayIndexOutOfBoundsException ex) {
- //System.out.println("No Chart Color");
}
if(catStr.length()>0) {
}
}
- //Object uniqueElements [] = ts.toArray();
- //SortedSet s = Collections.synchronizedSortedSet(ts);
- //uniqueElements = (String[]) ts.toArray();
DataColumnType dct = null;
List yTextSeries = reportRuntime.getChartDisplayNamesList(AppConstants.CHART_ALL_COLUMNS, formValues);
if(yTextSeries.size()==1) {
for (Iterator iter = l.iterator(); iter.hasNext();) {
dct = (DataColumnType) iter.next();
- //System.out.println(dct.getDisplayName() + " " + yText);
if(!(nvl(dct.getColOnChart()).equals(AppConstants.GC_LEGEND))) {
if(nvl(chartLeftAxisLabel).length()<=0) {
chartLeftAxisLabel = nvl(dct.getYAxis());
DataColumnType dct = null;
List yTextSeries = reportRuntime.getChartDisplayNamesList(AppConstants.CHART_ALL_COLUMNS, formValues);
- //if(columnValuesList.size() == 1) {
int dctIndex = 0;
for (Iterator iter = l.iterator(); iter.hasNext();) {
dct = (DataColumnType) iter.next();
- //System.out.println(dct.getDisplayName() + " " + yText);
if(!(nvl(dct.getColOnChart()).equals(AppConstants.GC_LEGEND))) {
if(yTextSeries.contains((String)dct.getDisplayName())) {
if(nvl(dct.getChartColor()).length()>0)
}
- //SortedSet s = Collections.synchronizedSortedSet(ts);
Object tempArray[] = ts.toArray();
uniqueElements = Arrays.copyOf(tempArray, tempArray.length, String[].class);
- //uniqueElements = (String[]) ts.toArray();
}
wholeScript.append("<script src=\""+ chartScriptsPath +"d3/js/d3.v3.min.js\"></script>\n");
wholeScript.append("<script src=\""+ chartScriptsPath +"d3/js/nv.d3.min.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/cumulativeLineChart.js\"></script> \n");
- //if(multipleSeries)
- //wholeScript.append("<script src=\""+ AppUtils.getBaseFolderURL() +"d3/js/models/multiChart.js\"></script> \n");
//json
wholeScript.append("<script> \n");
wholeScript.append("historicalBarChart = [ \n");
- //wholeScript.append("{ \n");
ArrayList dataSeries = new ArrayList();
String uniqueElement = "";
String [] uniqueRevElements = null;
//Added to make sure order appears same as legend
- /*if(nvl(subType).length() > 0 && subType.equals("area")) {
- uniqueRevElements = reverse((String[])uniqueElements);
- } else {*/
uniqueRevElements = (String[])uniqueElements;
- //}
int RIGHTAXISSERIES = 0;
for (int i = 0; i < uniqueRevElements.length; i++) {
- //element.substring(element.indexOf("|")+1)
uniqueElement = (String)uniqueRevElements[i];
if(multipleSeries && (nvl(chartRightAxisLabel).length() > 0)) {
if(nvl(subType).length() > 0 && subType.equals("area")) {
dataSeries.add(new StringBuffer(" { \"type\":\"line\", \"key\": \""+ ((uniqueElement.indexOf("|") != -1)?uniqueElement.substring(0, uniqueElement.indexOf("|")):uniqueElement) +"\", \"yAxis\": \""+(1)+"\","+ (hasCustomizedChartColor && (uniqueElement.lastIndexOf("|") != -1) ?("\"color\": \""+uniqueElement.substring(uniqueElement.lastIndexOf("|")+1) + "\","):"")+" \"values\": ["));
}
RIGHTAXISSERIES = dataSeries.size()-1;
- //dataSeries.add(new StringBuffer(" { \"type\":\"line\", \"key\": \""+ ((DataColumnType)columnMap.get(i)).getDisplayName() +"\", \"yAxis\": \""+(i+1)+"\", \"values\": ["));
}
else {
dataSeries.add(new StringBuffer(" { \"type\":\"line\", \"key\": \""+ ((uniqueElement.indexOf("|")!= -1)?uniqueElement.substring(0, uniqueElement.indexOf("|")):uniqueElement) +"\", \"yAxis\": \""+(1)+"\","+ (hasCustomizedChartColor && (uniqueElement.lastIndexOf("|") != -1)?("\"color\": \""+uniqueElement.substring(uniqueElement.lastIndexOf("|")+1) + "\","):"")+"\"values\": ["));
if(date==null && timeAxis)
continue;
-
- //if(ds.getString(i, 2).equals(uniqueElements[j])) {
- //if(minTime > date.getTime())
- // minTime = date.getTime();
uniqueElement = (String)uniqueRevElements[j];
try {
YAXISNUM = Integer.parseInt(ds.getString(i, columnMap.get(((hasCustomizedChartColor||nvl(chartRightAxisLabel).length()>0) && (uniqueElement.lastIndexOf("|") != -1)?uniqueElement.substring(0, uniqueElement.lastIndexOf("|")):uniqueElement))));
date = getDateFromDateStr(dateStr);
((StringBuffer) dataSeries.get(j)).append ("{ \"x\":" + date.getTime() + " , \"y\":" + null +"}, ");
}
- //((StringBuffer) dataSeries.get(j)).append ("{ \"x\":" + date.getTime() + " , \"y\":" + null +"}, ");
}
}
}
-
-
- //}
+
}
- //((StringBuffer) dataSeries.get(j)).append ("{ \"x\":" + minTime + " , \"y\":" + 0 +"}, ");
}
} else {
continue;
uniqueElement = (String)uniqueRevElements[j];
- //date = MMDDYYYYFormat.parse(ds.getString(i, 1), new ParsePosition(0));
if(ds.getString(i, 2).equals(((hasCustomizedChartColor||nvl(chartRightAxisLabel).length()>0) && (uniqueElement.lastIndexOf("|") != -1) ?uniqueElement.substring(0, uniqueElement.lastIndexOf("|")):uniqueElement))) {
- //if(minTime > date.getTime())
- // minTime = date.getTime();
+
try {
YAXISNUM = Integer.parseInt(ds.getString(i, 3));
if(MAXDOUBLENUM < YAXISNUM)
/* Sorting is commented out.*/
StringBuffer dateStrBuf = new StringBuffer("");
if(dateList.size()>0) {
- //SortedSet<String> s = Collections.synchronizedSortedSet(dateList);
Object[] dateElements = (Object[]) dateList.toArray();
String element = "";
wholeScript.append(" var chart;\n");
wholeScript.append("nv.addGraph(function() { \n");
- //" var chart = nv.models.cumulativeLineChart() \n" + nv.models.lineWithFocusChart()
-// " chart = nv.models.lineChart() \n" +
if(nvl(subType).length() > 0 && subType.equals("area")) {
wholeScript.append(" chart = nv.models.stackedAreaChart() \n");
if(showControls) {