Liferay FusionCharts Integration


How to do ” Liferay FusionCharts Integration”
Its easy simple …
Problem:exists:
You might given the syntax to include flash chart swf, xml [say for eg ]

I pasted Only Snippets in the html/jsp file used to include fusion charts ……
1.
<script language=”JavaScript” src=”js/FusionCharts.js”></script>
<link  rel=’stylesheet’ href=”Contents/Style.css” />

2. <script type=”text/javascript”>
var myChart = new FusionCharts(“Charts/StackedColumn3D.swf”, “chart1”, “580”, “300”, “0”, “0”);
myChart.setDataURL(“Data/Summary/Revenue2005.xml”);
myChart.render(“chart1”);
</script>

the problem

In portlet the location of swf, xml file cannot be known ..

Solution is to let portlet identify the location of swf/ xml file to display charts

Solution

1. Get the location of the portlet by

String pathPrefix=renderRequest.getContextPath();  //in jsp

1.<script language=”JavaScript” src='<%=pathPrefix%>/js/FusionCharts.js’></script>
<link  rel=’stylesheet’ href='<%=pathPrefix%>/Contents/Style.css’ />

2. <script type=”text/javascript”>
var myChart = new FusionCharts(“<%=pathPrefix%> /Charts/StackedColumn3D.swf?registerWithJS=1”, “chart1”, “580”, “300”, “0”, “0”);
myChart.setDataURL(“<%=pathPrefix%>Data/Summary/Revenue2005.xml”);
myChart.render(“chart1”);
</script>

FOLLOW THE SAME WHERE EVER NEEDED …….

ENJOY ..

Advertisements

One thought on “Liferay FusionCharts Integration

Leave a Reply

Fill in your details below or click an icon to log in:

WordPress.com Logo

You are commenting using your WordPress.com account. Log Out / Change )

Twitter picture

You are commenting using your Twitter account. Log Out / Change )

Facebook photo

You are commenting using your Facebook account. Log Out / Change )

Google+ photo

You are commenting using your Google+ account. Log Out / Change )

Connecting to %s