Sign in to follow this  
Ranen

Drill Down:: Liferay Portlet:: Not Working

Recommended Posts

Hello Guys,

 

Does anyone has any drill down chart working example with Liferay as server?

 

Here is my issue:-

 

I created a portlet which displays 2 charts(pie and column(=MSColumn2D.swf)), now I want to drill down in the pie. To do that I have a link in the pie chart's xml.

 

I used javascript function for that, now Pie charts comes up, click on a pie, using java script, I can got to java Controller which creates the drill down xml dynamically and populate the data in the jsp, but I cannot see the jsp.

 

 

Here is my flow - Portlet with 2 charts --> click on pie-->control comes to Portlet Controller-->portlet controller creates a dynamic xml,pass the data to new jsp

 

But I cannot see the new jsp with the drill down chart.

 

So, can the experts tell me where I am wrong.

 

Here is my code snippet:-

 

First Jsp =

<%@ taglib prefix="c" uri="http://java.sun.com/jsp/jstl/core" %>
<%@ taglib uri="http://www.fusioncharts.com/jsp/core" prefix="fc" %> 
<%@ taglib prefix="tags" tagdir="/WEB-INF/tags" %>
<%@ taglib uri="http://java.sun.com/portlet_2_0" prefix="portlet" %>
<portlet:defineObjects/>
<script src="http://code.jquery.com/jquery-1.4.2.min.js"></script>

<c:set var="folderPath" value="/ChartHandler-portlet/FusionCharts/"/>
<c:set var="title" value="FusionCharts - Array Example using Single Series Column 3D Chart" scope="request"/>
<c:set var="header1" value="FusionCharts - Examples" scope="request"/>
<c:set var="header2" value=" " scope="request"/>
<c:set var="jsPath" value="${folderPath}" scope="request"/>
<c:set var="assetCSSPath" value="/ChartHandler-portlet/JSP/assets/ui/css/" scope="request"/>
<c:set var="assetJSPath" value="/ChartHandler-portlet/JSP/assets/ui/js/" scope="request"/>
<c:set var="assetImagePath" value="/ChartHandler-portlet/JSP/assets/ui/images/" scope="request"/>
<%@page import="com.bfds.web.bean.PieColumnChartBean"%>
<%@page import="com.bfds.web.bean.PieDetailBean"%>

<%
	PieColumnChartBean pieColumnChartBean = (PieColumnChartBean)renderRequest.getAttribute("pieColumnChartBean");	
%>

  <SCRIPT LANGUAGE="JavaScript">
      function myJS(myVar){
    	  window.alert(myVar);          
          var url = '<portlet:renderURL></portlet:renderURL>';
          jQuery.post(url,{tradeOrigin : myVar},function() {          
         	});    
      }
  </SCRIPT>

<div>
<div class="left">
		<tags:template2>
		<fc:render chartId="${pieColumnChartBean.chartIdPie}" swfFilename="/ChartHandler-portlet/FusionCharts/Pie2D.swf"
		 width="450" height="300" debugMode="false" registerWithJS="false" xmlData="${pieColumnChartBean.pieXml}" />		
		</tags:template2>
	</div>
	<div class="right">
		<tags:template2>
		<fc:render chartId="${pieColumnChartBean.chartIdColumn}" swfFilename="/ChartHandler-portlet/FusionCharts/MSColumn2D.swf"
		 width="450" height="300" debugMode="false" registerWithJS="false" xmlData="${pieColumnChartBean.columnXml}" />
		</tags:template2>
	</div>
</div>


Second Jsp(drill down one)::

<%@ taglib prefix="c" uri="http://java.sun.com/jsp/jstl/core" %>
<%@ taglib uri="http://www.fusioncharts.com/jsp/core" prefix="fc" %> 
<%@ taglib prefix="tags" tagdir="/WEB-INF/tags" %>
<%@ taglib uri="http://java.sun.com/portlet_2_0" prefix="portlet" %>

<portlet:defineObjects/>
<c:set var="folderPath" value="/ChartHandler-portlet/FusionCharts/"/>
<c:set var="title" value="FusionCharts - Array Example using Single Series Column 3D Chart" scope="request"/>
<c:set var="header1" value="FusionCharts - Examples" scope="request"/>
<c:set var="header2" value=" " scope="request"/>
<c:set var="jsPath" value="${folderPath}" scope="request"/>
<c:set var="assetCSSPath" value="/ChartHandler-portlet/JSP/assets/ui/css/" scope="request"/>
<c:set var="assetJSPath" value="/ChartHandler-portlet/JSP/assets/ui/js/" scope="request"/>
<c:set var="assetImagePath" value="/ChartHandler-portlet/JSP/assets/ui/images/" scope="request"/>

<%@page import="com.bfds.web.bean.PieDetailBean"%>
<%
	PieDetailBean pieDetailBean = (PieDetailBean)renderRequest.getAttribute("pieDetailBean");	
%>

<div>
<div class="left">
		<tags:template2>
		<fc:render chartId="${pieDetailBean.chartIdPieDetail}" swfFilename="/ChartHandler-portlet/FusionCharts/Column2D.swf"
		 width="450" height="300" debugMode="true" registerWithJS="false" xmlData="${pieDetailBean.pieDetailXml}" />		
		</tags:template2>
	</div>	
</div>


Java Controller:-

public void doView(RenderRequest renderRequest, RenderResponse renderResponse) throws PortletException, IOException{
		if(renderRequest.getParameter("chartName") !=null && renderRequest.getParameter("chartName").equals("PieColumn Chart")){
				PieColumnChartBean pieColumnChartBean = new PieColumnChartBean();
				renderRequest.setAttribute("pieColumnChartBean", pieColumnChartBean);		
				viewJSP = "/JSP/pieColumn.jsp";
			} else if(tradeOrigin!=null && tradeOrigin.length() >0){
				PieDetailBean pieDetailBean = new PieDetailBean(tradeOrigin);
				renderRequest.setAttribute("pieDetailBean", pieDetailBean);		
				viewJSP = "/JSP/pieDetail.jsp";
			}
			
    	include(viewJSP, renderRequest, renderResponse);
	}
	

 

 

Share this post


Link to post
Share on other sites

Hello Guys,

 

I found the error for this task, its related with js, here are the error details:-

 

 

SCRIPT5022: There was an error rendering the chart. Enable FusionCharts JS debugMode for more information. 
FusionCharts.js, line 15 character 6193
SCRIPT5022: There was an error rendering the chart. Enable FusionCharts JS debugMode for more information. 
FusionCharts.js, line 15 character 6193
 
ANyidea how can I fix this error.

Share this post


Link to post
Share on other sites

I am attaching 2 images, whats happening when I click in a piechart for drill down - it did not display the lower level chart - I get this error-

 

 

SCRIPT5022: There was an error rendering the chart. Enable FusionCharts JS debugMode for more information. 
FusionCharts.js, line 15 character 6193
 
Now, if i enable the debug=true, no clue at all bcoz my data xml is file is perfact.
 
now if I refresh the page I can see the image 2(ref to the attachment). can someone tell me where I am wrong?

Share this post


Link to post
Share on other sites

Hi Ranen,


 
The drill down feature on charts deployed on LifeRay server work fine.
 
Could you please send us the "PieDetailBean" as well so that we can check the XML that is being set in the "pieDetailXml" variable?  It would be good if you could send us the demo sample that replicates the issue in a zip file so that we can deploy it here and check it.
 
Meanwhile, can you please check if the control is going into the else part that is the block that uses "PieDetailBean"?
 
Awaiting your response.

Share this post


Link to post
Share on other sites

Hello,

 

Thanks for your response.

 

Error You aren't permitted to upload this kind of file

 

I tried to upload .war file and .rar file...getting the above error.....

 

One more thing, since you are saying you are able to implement fusioncharts drill down feature in liferay portal server, can you pl upload something(like a .war file etc) which can help me resolving my issue.

 

Thanks

Share this post


Link to post
Share on other sites
PieColumnChartBean - first cha

import java.util.ArrayList;
import java.util.HashMap;
import java.util.List;
import java.util.Map;
import java.util.StringTokenizer;

import com.bfds.web.wsconsumer.ChartWSConsumer;
import com.fusioncharts.FusionChartsHelper;
import com.fusioncharts.sampledata.ChartType;

public class PieColumnChartBean {
		private String heightPie = "300";
		private String widthPie = "450";
		
		private String heightColumn = "300";
		private String widthColumn = "450";
		private String pieXml;	
		private String columnXml;
		
		private String chartIdPie = "transactionPie";
		private String chartIdColumn = "transactionColumn";
		private String url = null;		
		private String filename = ChartType.COLUMN3D.getFileName();
		
		public PieColumnChartBean(){
			ChartWSConsumer chartWSConsumer = new ChartWSConsumer();
			PieColumnChartRecords pieColumnChartRecordsForPie = chartWSConsumer.getPieColumnChartQueryForPie();
			PieColumnChartRecords pieColumnChartRecordsForColumn = chartWSConsumer.getPieColumnChartQueryForColumn();
			Map<String, PieColumnChartRecords> map = new HashMap<String, PieColumnChartRecords>();
			map.put("Pie", pieColumnChartRecordsForPie);
			map.put("Column", pieColumnChartRecordsForColumn);
			constructXML(map);
		}
		
		public String getHeightPie() {
			return heightPie;
		}
		public void setHeightPie(String heightPie) {
			this.heightPie = heightPie;
		}
		public String getWidthPie() {
			return widthPie;
		}
		public void setWidthPie(String widthPie) {
			this.widthPie = widthPie;
		}
		
		public String getPieXml() {
			return pieXml;
		}

		public void setPieXml(String pieXml) {
			this.pieXml = pieXml;
		}
		
		public String getColumnXml() {
			return columnXml;
		}

		public void setColumnXml(String columnXml) {
			this.columnXml = columnXml;
		}

		public String getChartIdPie() {
			return chartIdPie;
		}

		public void setChartIdPie(String chartIdPie) {
			this.chartIdPie = chartIdPie;
		}

		public String getChartIdColumn() {
			return chartIdColumn;
		}

		public void setChartIdColumn(String chartIdColumn) {
			this.chartIdColumn = chartIdColumn;
		}

		public String getUrl() {
			return url;
		}
		public void setUrl(String url) {
			this.url = url;
		}
		public String getFilename() {
			return filename;
		}
		public void setFilename(String filename) {
			this.filename = filename;
		}
		
		
		public String getHeightColumn() {
			return heightColumn;
		}

		public void setHeightColumn(String heightColumn) {
			this.heightColumn = heightColumn;
		}

		public String getWidthColumn() {
			return widthColumn;
		}

		public void setWidthColumn(String widthColumn) {
			this.widthColumn = widthColumn;
		}

		public void constructXML(Map<String, PieColumnChartRecords> map){
			PieColumnChartRecords pieColumnChartRecordsForPie = map.get("Pie");
			PieColumnChartRecords pieColumnChartRecordsForColumn = map.get("Column");
			
			List<PieColumnChartRecord> pieColumnChartRecordListForPie = null;
			List<PieColumnChartRecord> pieColumnChartRecordListForColumn = null;
			if(pieColumnChartRecordsForPie!=null)
				pieColumnChartRecordListForPie = pieColumnChartRecordsForPie.getPieColumnChartRecord();
			if(pieColumnChartRecordsForColumn!=null)
				pieColumnChartRecordListForColumn = pieColumnChartRecordsForColumn.getPieColumnChartRecord();						
			
			String chartNameToDisplay = null;
			if(pieColumnChartRecordListForPie!=null){
				chartNameToDisplay= pieColumnChartRecordListForPie.get(0).getMcName();
				pieXml ="<chart caption='"+chartNameToDisplay+"' showPercentValues='1'>";
				for(PieColumnChartRecord pie:pieColumnChartRecordListForPie){
					String pieLabel = pie.getTradeOrigin().substring(13, pie.getTradeOrigin().length());					
					String strDataURL = "j-myJS-"+pie.getTradeOrigin();
					pieXml +="<set label='"+pieLabel +"' value='"+pie.getTransactions()+ "' link='"+strDataURL+"'/>";
				}
				pieXml +="</chart>";
			}
			
			System.out.println("<<<< pieXML >>>>>>" +pieXml);
			
			if(pieColumnChartRecordListForColumn!=null){
				columnXml="<chart caption='"+chartNameToDisplay+"' xAxisName='Channel' yAxisName='Percent of Transactions' numberPrefix='' showValues='0'><categories>";
				
				for(PieColumnChartRecord column:pieColumnChartRecordListForColumn){	
					String columnLabel = column.getTradeOrigin().substring(13, column.getTradeOrigin().length());
					columnXml +="<category label='"+columnLabel+"'/>";
				}
				columnXml +="</categories>";
				columnXml +="<dataset seriesName='Name1'>";
				for(PieColumnChartRecord column:pieColumnChartRecordListForColumn){	
						columnXml +="<set value='"+column.getTransactions()+"'/>";	
					}
				columnXml +="</dataset>";
			}
				if(pieColumnChartRecordListForPie!=null){
					columnXml +="<dataset seriesName='Name2'>";
					for(PieColumnChartRecord pie:pieColumnChartRecordListForPie){	
							columnXml +="<set value='"+pie.getTransactions()+"'/>";	
						}
						columnXml +="</dataset>";
					}									
				
				columnXml +="</chart>";
				
				System.out.println("columnXml>>>> " + columnXml);
		}
}





PieDetailBean - this is the drill down bean

import java.util.List;

import com.bfds.web.wsconsumer.ChartWSConsumer;
import com.fusioncharts.sampledata.ChartType;

public class PieDetailBean {
	private String heightPieDetail = "300";
	private String widthPieDetail = "450";	
	private String pieDetailXml;
	
	private String chartIdPieDetail = "transactionPieDetail";
	private String url = null;		
	private String filename = ChartType.COLUMN3D.getFileName();
	
	public String getHeightPieDetail() {
		return heightPieDetail;
	}
	public void setHeightPieDetail(String heightPieDetail) {
		this.heightPieDetail = heightPieDetail;
	}
	public String getWidthPieDetail() {
		return widthPieDetail;
	}
	public void setWidthPieDetail(String widthPieDetail) {
		this.widthPieDetail = widthPieDetail;
	}
	public String getPieDetailXml() {
		return pieDetailXml;
	}
	public void setPieDetailXml(String pieDetailXml) {
		this.pieDetailXml = pieDetailXml;
	}
	public String getChartIdPieDetail() {
		return chartIdPieDetail;
	}
	public void setChartIdPieDetail(String chartIdPieDetail) {
		this.chartIdPieDetail = chartIdPieDetail;
	}
	public String getUrl() {
		return url;
	}
	public void setUrl(String url) {
		this.url = url;
	}
	public String getFilename() {
		return filename;
	}
	public void setFilename(String filename) {
		this.filename = filename;
	}
	
	public PieDetailBean(String tradeOrigin){
		ChartWSConsumer chartWSConsumer = new ChartWSConsumer();
		PieColumnChartRecords pieColumnChartRecordsForPie = chartWSConsumer.getPieColumnChartQueryForDrillDownColumn1(tradeOrigin);
		constructXML(pieColumnChartRecordsForPie);
	}
	
	public String constructXML(PieColumnChartRecords pieColumnChartRecordsForPie){
		List<PieColumnChartRecord> pieColumnChartRecordList = null;		
		if(pieColumnChartRecordsForPie !=null){
				pieColumnChartRecordList = pieColumnChartRecordsForPie.getPieColumnChartRecord();
		}		
		if(pieColumnChartRecordList!=null){
			String chartNameToDisplay= pieColumnChartRecordList.get(0).getMcName();
			pieDetailXml="<chart caption='"+chartNameToDisplay+"' xAxisName='Transaction Count' yAxisName='Transactions' numberPrefix='' showValues='0'>";		
			for(PieColumnChartRecord pieDetails1:pieColumnChartRecordList){
				if(pieDetails1!=null){
					String columnLabel = pieDetails1.getTransactionType().trim();
					pieDetailXml +="<set label='"+columnLabel+"' value='"+pieDetails1.getTransactions()+ "'/>";
					}
				}
				pieDetailXml +="</chart>";
			}
		System.out.println("pie Detail Xml >>>>>>>>>>>>>>>>>>>>>>"+ pieDetailXml);
		
		return pieDetailXml;
	}

}

jsps:-

this is the first jsp

<%@ taglib prefix="c" uri="http://java.sun.com/jsp/jstl/core" %>
<%@ taglib uri="http://www.fusioncharts.com/jsp/core" prefix="fc" %> 
<%@ taglib prefix="tags" tagdir="/WEB-INF/tags" %>
<%@ taglib uri="http://java.sun.com/portlet_2_0" prefix="portlet" %>
<portlet:defineObjects/>
<script src="http://code.jquery.com/jquery-1.4.2.min.js"></script>

<c:set var="folderPath" value="/ChartHandler-portlet/FusionCharts/"/>
<c:set var="title" value="FusionCharts - Array Example using Single Series Column 3D Chart" scope="request"/>
<c:set var="header1" value="FusionCharts - Examples" scope="request"/>
<c:set var="header2" value=" " scope="request"/>
<c:set var="jsPath" value="${folderPath}" scope="request"/>
<%-- <c:set var="assetCSSPath" value="/ChartHandler-portlet/JSP/assets/ui/css/" scope="request"/> --%>
<%-- <c:set var="assetJSPath" value="/ChartHandler-portlet/JSP/assets/ui/js/" scope="request"/> --%>
<c:set var="assetImagePath" value="/ChartHandler-portlet/JSP/assets/ui/images/" scope="request"/>
<%@page import="com.bfds.web.bean.PieColumnChartBean"%>
<%@page import="com.bfds.web.bean.PieDetailBean"%>

<%
	PieColumnChartBean pieColumnChartBean = (PieColumnChartBean)renderRequest.getAttribute("pieColumnChartBean");
%>

  <SCRIPT LANGUAGE="JavaScript">
      function myJS(myVar){
    	  window.alert(myVar);          
          var url = '<portlet:actionURL></portlet:actionURL>';
          jQuery.post(url,{tradeOrigin : myVar},function() {          
         	});    
      }
  </SCRIPT>

		<tags:template2>
		<table>
			<tr>
				<td>
					<fc:render chartId="${pieColumnChartBean.chartIdPie}" swfFilename="/ChartHandler-portlet/FusionCharts/Pie2D.swf"
					width="450" height="300" debugMode="false" registerWithJS="false" xmlData="${pieColumnChartBean.pieXml}" />		
				</td>
				<td>
					<fc:render chartId="${pieColumnChartBean.chartIdColumn}" swfFilename="/ChartHandler-portlet/FusionCharts/MSColumn2D.swf"
					width="450" height="300" debugMode="false" registerWithJS="false" xmlData="${pieColumnChartBean.columnXml}" />
				</td>
			</tr>
		</table>
		
		</tags:template2>


this is the drill down jsp:-

<%@ taglib prefix="c" uri="http://java.sun.com/jsp/jstl/core" %>
<%@ taglib uri="http://www.fusioncharts.com/jsp/core" prefix="fc" %> 
<%@ taglib prefix="tags" tagdir="/WEB-INF/tags" %>
<%@ taglib uri="http://java.sun.com/portlet_2_0" prefix="portlet" %>
<portlet:defineObjects/>
<script src="http://code.jquery.com/jquery-1.4.2.min.js"></script>
<c:set var="folderPath" value="/ChartHandler-portlet/FusionCharts/"/>
<c:set var="title" value="FusionCharts - Array Example using Single Series Column 3D Chart" scope="request"/>
<c:set var="header1" value="FusionCharts - Examples" scope="request"/>
<c:set var="header2" value=" " scope="request"/>
<c:set var="jsPath" value="${folderPath}" scope="request"/>

<%@page import="com.bfds.web.bean.PieDetailBean"%>
<%
	PieDetailBean pieDetailBean = (PieDetailBean)renderRequest.getAttribute("pieDetailBean");
	System.out.println("pieDetailBean xml >>>> in JSP >>>"+ pieDetailBean);
	if(pieDetailBean!=null)
		System.out.println("pieDetailBean xml >>>> in JSP >>>"+ pieDetailBean.getPieDetailXml());
%>

<tags:template2>
	<table>
		<tr>
			<td>
				<fc:render chartId="${pieDetailBean.chartIdPieDetail}" swfFilename="/ChartHandler-portlet/FusionCharts/Column2D.swf"
	 				width="450" height="300" debugMode="false" registerWithJS="false" xmlData="${pieDetailBean.pieDetailXml}" />
			 </td>
		</tr>
	</table>		
</tags:template2>



 

 

Share this post


Link to post
Share on other sites


This is the first controller:-

 

import java.io.IOException;

import java.util.ArrayList;

import java.util.List;

 

import javax.portlet.ActionRequest;

import javax.portlet.ActionResponse;

import javax.portlet.Event;

import javax.portlet.EventRequest;

import javax.portlet.EventResponse;

import javax.portlet.GenericPortlet;

import javax.portlet.PortletException;

import javax.portlet.PortletRequestDispatcher;

import javax.portlet.PortletSession;

import javax.portlet.RenderRequest;

import javax.portlet.RenderResponse;

import javax.portlet.ProcessEvent;

import javax.portlet.ResourceRequest;

import javax.portlet.ResourceResponse;

import javax.xml.namespace.QName;

 

import com.bfds.web.bean.PieColumnChartBean;

import com.bfds.web.bean.PieDetailBean;

import com.bfds.web.bean.PurRedNetBean;

import com.bfds.web.bean.PurRedNetForZoomlineChartRecords;

import com.bfds.web.bean.PurRedNetZoomlineBean;

import com.bfds.web.bean.TransactionBarChartBean;

import com.bfds.web.wsconsumer.ChartWSConsumer;

import com.liferay.util.bridges.mvc.MVCPortlet;

 

public class BFDSChartDisplayController extends MVCPortlet{//GenericPortlet{

 

String viewJSP=null;

 

public void init(){

 

}

 

public void doView(RenderRequest renderRequest, RenderResponse renderResponse) throws PortletException, IOException{

 

System.out.println("<<<<<<<<<<<<<<< BFDSChartDisplayController >>>>>>>>>>>>>>>>>>> doView ");

 

ChartWSConsumer chartWSConsumer = new ChartWSConsumer();

PurRedNetForZoomlineChartRecords purRedNetForZoomlineChartRecords = chartWSConsumer.getZoomLineChartData();

PortletSession portletSession = renderRequest.getPortletSession();

portletSession.setAttribute("purRedNetForZoomlineChartRecords", purRedNetForZoomlineChartRecords);

 

TransactionBarChartBean transactionBarChartBean = null;

PurRedNetZoomlineBean purRedNetZoomlineBean = null;

if(renderRequest.getParameter("chartName") !=null){

if(renderRequest.getParameter("chartName").equals("Transaction Chart")){

transactionBarChartBean = new TransactionBarChartBean();

transactionBarChartBean.constructXML1(purRedNetForZoomlineChartRecords);

renderRequest.setAttribute("transactionBarChartBean", transactionBarChartBean);

viewJSP = "/JSP/transactionBarChart.jsp";

} else if(renderRequest.getParameter("chartName").equals("Zoomline Chart")){

purRedNetZoomlineBean = new PurRedNetZoomlineBean();

purRedNetZoomlineBean.constructXML(purRedNetForZoomlineChartRecords);

renderRequest.setAttribute("purRedNetZoomlineBean", purRedNetZoomlineBean);

viewJSP = "/JSP/zoomLineChart.jsp";

} else if(renderRequest.getParameter("chartName").equals("PieColumn Chart")){

System.out.println("<<<<< in the controller to get pie-column chart >>>>>");

PieColumnChartBean pieColumnChartBean = new PieColumnChartBean();

renderRequest.setAttribute("pieColumnChartBean", pieColumnChartBean);

 

viewJSP = "/JSP/pieColumn.jsp";

}

// else if(tradeOrigin!=null && tradeOrigin.length() >0){

// System.out.println("doView >>>> tradeOrigin >>>>> 1 == "+ tradeOrigin);

// PieDetailBean pieDetailBean = new PieDetailBean(tradeOrigin);

// System.out.println("doView >>>> tradeOrigin >>>>> 2 == "+ tradeOrigin);

// renderRequest.setAttribute("pieDetailBean", pieDetailBean);

// System.out.println("doView >>>> tradeOrigin >>>>> 3 == "+ tradeOrigin);

// //viewJSP = "/JSP/pieDetail.jsp";

// viewJSP = "/JSP/pieColumn.jsp";

}

 

include(viewJSP, renderRequest, renderResponse);

}

 

public void processAction(ActionRequest request, ActionResponse response) throws PortletException, IOException {

String tradeOrigin = request.getParameter("tradeOrigin");

System.out.println(" BFDSChartDisplayController <<<<<<<<<< processAction <<<<<<<< tradeOrigin = "+ tradeOrigin);

request.setAttribute("tradeOrigin", tradeOrigin);

QName qname = new QName("http://liferay.com/events","tradeOrigin.data");

System.out.println(" BFDSChartDisplayController <<<<<<<<<< processAction <<<<<<<< qname = "+ qname.getLocalPart() + "::::" +qname.getNamespaceURI());

response.setEvent(qname, tradeOrigin);

}

 

 

@Override

public void serveResource(ResourceRequest request, ResourceResponse response) throws PortletException, IOException {

System.out.println("<<<<<<<<<< in serveResourcse >>>>>>>>>>>>>>>.");

String jsp = null;

response.setContentType("text/html");

String resourceId = request.getResourceID();

System.out.println("resourceId >>> = "+ resourceId);

String tradeOrigin = request.getParameter("tradeOrigin");

System.out.println("tradeOrigin >>> = "+ tradeOrigin);

 

 

}

 

protected void include(String path, RenderRequest renderRequest, RenderResponse renderResponse) throws IOException, PortletException {

PortletRequestDispatcher portletRequestDispatcher = getPortletContext().getRequestDispatcher(path);

if (portletRequestDispatcher == null) {

System.out.println(path + " is not a valid include");

} else {

portletRequestDispatcher.include(renderRequest, renderResponse);

}

}

 

@ProcessEvent(qname = "{http://liferay.com/events}chart.data")

public void receiveEvent(EventRequest request, EventResponse response)

{

Event event = request.getEvent();

String chartName = (String)event.getValue();

System.out.println(" BFDSChartDisplayController >>>>>>>>receiveEvent>>>>>>>>> chartName = " + chartName);

response.setRenderParameter("chartName", chartName);

}

 

}

 

 

 

 

 

This is the second controller:-

 

import java.io.IOException;

 

import javax.portlet.Event;

import javax.portlet.EventRequest;

import javax.portlet.EventResponse;

import javax.portlet.GenericPortlet;

import javax.portlet.PortletException;

import javax.portlet.PortletRequestDispatcher;

import javax.portlet.ProcessEvent;

import javax.portlet.RenderRequest;

import javax.portlet.RenderResponse;

 

import com.bfds.web.bean.PieDetailBean;

import com.liferay.util.bridges.mvc.MVCPortlet;

 

public class BFDSPieChartDrillDownController extends MVCPortlet{//GenericPortlet{

 

String viewJSP=null;

 

public void doView(RenderRequest renderRequest, RenderResponse renderResponse) throws PortletException, IOException{

System.out.println("<<<<<<<<<<<<<<< BFDSPieChartDrillDownController >>>>>>>>>>>>>>>>>>> doView ");

String tradeOrigin = renderRequest.getParameter("tradeOrigin");

//tradeOrigin ="TRADE-ORIGIN-NSCC";

System.out.println("BFDSPieChartDrillDownController>>>>>doView >>>> tradeOrigin >>>>> 3 == "+ tradeOrigin);

if(tradeOrigin!=null && tradeOrigin.length() >0){

PieDetailBean pieDetailBean = new PieDetailBean(tradeOrigin);

renderRequest.setAttribute("pieDetailBean", pieDetailBean);

viewJSP = "/JSP/pieDetail.jsp";

}

System.out.println("BFDSPieChartDrillDownController >>>> doView >>>> tradeOrigin >>>>> 4 == "+ tradeOrigin);

include(viewJSP, renderRequest, renderResponse);

}

 

protected void include(String path, RenderRequest renderRequest, RenderResponse renderResponse) throws IOException, PortletException {

PortletRequestDispatcher portletRequestDispatcher = getPortletContext().getRequestDispatcher(path);

System.out.println("<<<<<<<include<<<<<<<< BFDSPieChartDrillDownController >>>>>>>>>>>>>>>>>>> path >>> =" +path);

System.out.println("<<<<<<<include<<<<<<<< BFDSPieChartDrillDownController >>>>>>>>>>>>>>>>>>> portletRequestDispatcher >>> =" +portletRequestDispatcher);

if (portletRequestDispatcher == null) {

System.out.println(path + " is not a valid include");

} else {

portletRequestDispatcher.include(renderRequest, renderResponse);

}

}

 

@ProcessEvent(qname = "{http://liferay.com/events}tradeOrigin.data")

public void receiveEvent(EventRequest request, EventResponse response)

{

Event event1 = request.getEvent();

String tradeOrigin = (String)event1.getValue();

System.out.println(" BFDSPieChartDrillDownController >>>>>>>>receiveEvent>>>>>>>>> tradeOrigin = " + tradeOrigin);

response.setRenderParameter("tradeOrigin", tradeOrigin);

}

 

}

 

 

 

Share this post


Link to post
Share on other sites

Further findings:-

 

Situation 1:-

 

I got the Piechart in the browser. Click on a pie- 

expected result- 2D column chart should display under the piechart, but not displaying, just empty jsp.

 

I debugged here using chrome developer tool - I found below html code inside the debugger:-

 

 

<div class="gen-chart-render"> 
<table> <tbody><tr> <td>
<!-- START Script Block for Chart --> 
<div id="Div" align="center"><span id=""></span></div> 
<script type="text/javascript"> 
var chart_ = new FusionCharts({"registerWithJS":"0","height":"300","id":"","renderAt":"Div","dataFormat":"xml","swfUrl":"/ChartHandler-portlet/FusionCharts/Column2D.swf","debugMode":"0","width":"450"}).render(); </script>
<!--END Script Block for Chart --> 
</td> </tr> </tbody></table>
</div>
 
 
NB - I printed the pieDetailXml from pieDetailBean - it printed in the console, so the xml file is inside the jsp, but when I debug the jsp, I cannot see the xml data.(plz look above- there is no xml data)
 
Situation 2:- 
 
Now I refresh the page - right click reload - now I can see the pie chart and the drill down 2D column chart and I debugged the code, here is the out put
 
<div class="gen-chart-render">
<table> <tbody><tr> <td> 
<div id="transactionPieDetailDiv" align="center">
<object type="application/x-shockwave-flash" lang="EN" class="FusionCharts" data="/ChartHandler-portlet/FusionCharts/Column2D.swf" width="450" height="300" id="transactionPieDetail" style="visibility: visible;">
<param name="scaleMode" value="noScale">
<param name="scale" value="noScale">
<param name="wMode" value="opaque">
<param name="allowScriptAccess" value="always">
<param name="quality" value="best">
<param name="flashvars" value="lang=EN&debugMode=0&dataXML=%3Cchart%20caption%3D'Russell%20Investment%20Company'%20xAxisName%3D'Transaction%20Count'%20yAxisName%3D'Transactions'%20numberPrefix%3D''%20showValues%3D'0'%3E%3Cset%20label%3D'CANCEL'%20value%3D'87'%2F%3E%3Cset%20label%3D'EXCHANGE'%20value%3D'1442'%2F%3E%3Cset%20label%3D'PURCHASE'%20value%3D'37323'%2F%3E%3Cset%20label%3D'REDEMPT'%20value%3D'41248'%2F%3E%3Cset%20label%3D'TRANSFEE'%20value%3D'3'%2F%3E%3Cset%20label%3D'TRANSFER'%20value%3D'10093'%2F%3E%3C%2Fchart%3E&DOMId=transactionPieDetail&registerWithJS=1&chartWidth=450&chartHeight=300&InvalidXMLText=Invalid data.&dataURL=">
</object>
</div> 
<script type="text/javascript"> 
var chart_transactionPieDetail = new FusionCharts({"registerWithJS":"0","height":"300","id":"transactionPieDetail","renderAt":"transactionPieDetailDiv","dataFormat":"xml","swfUrl":"/ChartHandler-portlet/FusionCharts/Column2D.swf","dataSource":"<chart caption='Russell Investment Company' xAxisName='Transaction Count' yAxisName='Transactions' numberPrefix='' showValues='0'><set label='CANCEL' value='87'/><set label='EXCHANGE' value='1442'/><set label='PURCHASE' value='37323'/><set label='REDEMPT' value='41248'/><set label='TRANSFEE' value='3'/><set label='TRANSFER' value='10093'/></chart>","debugMode":"0","width":"450"}).render(); </script> <!--END Script Block for Chart transactionPieDetail--> </td> </tr> </tbody></table>
 
And the above code has got the xml content, I just refresh, never click any pie. 
 
So why is it behaving this way? any idea?

Share this post


Link to post
Share on other sites

And few .js files are loaded from liferay-portket.xml and correctly loaded-

 

 

 

<?xml version="1.0"?>
<!DOCTYPE liferay-portlet-app PUBLIC "-//Liferay//DTD Portlet Application 6.1.0//EN" "http://www.liferay.com/dtd/liferay-portlet-app_6_1_0.dtd">
 
<liferay-portlet-app>
<portlet>
<portlet-name>ChartHandler</portlet-name>
<icon>/icon.png</icon>
<instanceable>true</instanceable>
<header-portlet-css>/css/test.css</header-portlet-css>
<footer-portlet-javascript>/js/test.js</footer-portlet-javascript>
</portlet>
 
<portlet>
<portlet-name>DisplayHandler</portlet-name>
<icon>/icon.png</icon>
<instanceable>true</instanceable>
<header-portlet-css>/css/test.css</header-portlet-css>
<footer-portlet-javascript>/js/test.js</footer-portlet-javascript>
<!-- <header-portlet-css>/JSP/assets/ui/css/style.css</header-portlet-css> -->
<footer-portlet-javascript>/js/FusionCharts.js</footer-portlet-javascript>
<footer-portlet-javascript>/JSP/assets/ui/js/jquery-1.4.2.min.js</footer-portlet-javascript>
<footer-portlet-javascript>/JSP/assets/ui/js/lib.js</footer-portlet-javascript>
</portlet>
 
<portlet>
<portlet-name>PieDrillDown</portlet-name>
<icon>/icon.png</icon>
<instanceable>true</instanceable>
<header-portlet-css>/css/test.css</header-portlet-css>
<!-- <header-portlet-css>/JSP/assets/ui/css/style.css</header-portlet-css> -->
<footer-portlet-javascript>/js/FusionCharts.js</footer-portlet-javascript>
<footer-portlet-javascript>/JSP/assets/ui/js/jquery-1.4.2.min.js</footer-portlet-javascript>
<footer-portlet-javascript>/JSP/assets/ui/js/lib.js</footer-portlet-javascript>
</portlet>
<role-mapper>
<role-name>administrator</role-name>
<role-link>Administrator</role-link>
</role-mapper>
<role-mapper>
<role-name>guest</role-name>
<role-link>Guest</role-link>
</role-mapper>
<role-mapper>
<role-name>power-user</role-name>
<role-link>Power User</role-link>
</role-mapper>
<role-mapper>
<role-name>user</role-name>
<role-link>User</role-link>
</role-mapper>
</liferay-portlet-app>

Share this post


Link to post
Share on other sites

Haritha or anyone from support team, can you plz help me solving this issue,I just want to know how did u successfully implemnted Drill down fusionchart in liferay?

Share this post


Link to post
Share on other sites

Hi,

 
Apologies for delay in reply.
 
We have a sample with static XML using drill down feature which works fine when deployed on LifeRay Portal.
 
We are looking into your code to find out the issue. However, can you please zip the files and send us a working sample to [email protected]  so that we can deploy it here and replicate the issue?
 
Awaiting your response.

Share this post


Link to post
Share on other sites

Create an account or sign in to comment

You need to be a member in order to leave a comment

Create an account

Sign up for a new account in our community. It's easy!

Register a new account

Sign in

Already have an account? Sign in here.

Sign In Now
Sign in to follow this