Forums

Home » Liferay Portal » English » 3. Development

Combination View Flat View Tree View
Threads [ Previous | Next ]
toggle
Rotsen Zerolf
Chart portlet
February 28, 2008 7:57 AM
Answer

Rotsen Zerolf

Rank: Junior Member

Posts: 32

Join Date: January 16, 2008

Recent Posts

Is there a sample portlet displaying pie charts where all we have to do is pluging our data.

I have been trying to create a portlet using Jfreechart but my knowledge of Java and portlets
creation is very bad.

Thanks,

rotseN
Ricardo Uhalde
RE: Chart portlet
February 28, 2008 8:56 AM
Answer

Ricardo Uhalde

Rank: New Member

Posts: 9

Join Date: September 20, 2007

Recent Posts

Take a look at BIRT project at http://www.eclipse.org/birt/phoenix/

Its a report solution that you can easily integrate inside a portlet with an IFrame by means of their Web Viewer. BIRT also has one of the best report designers of all, better than jasperreport Ireport.

You can use it to generate many types of charts, pie, bars, gantt, etc. Give it a try, you'll loved as I did.
Rotsen Zerolf
RE: Chart portlet
February 28, 2008 2:18 PM
Answer

Rotsen Zerolf

Rank: Junior Member

Posts: 32

Join Date: January 16, 2008

Recent Posts

I am downloading BIRT with everything. My problem is that I do not know how to create a portlet.
There a examples of portlets with JSP file but I do not know how to create a portlet with a Java file and then when I
compile the java file I need to name it as the class is named inside the file, so how do I convert this java file to be
index.jsp which is the default file for portlet. I am also reading about all the different XML files
Rotsen Zerolf
RE: Chart portlet
February 28, 2008 4:18 PM
Answer

Rotsen Zerolf

Rank: Junior Member

Posts: 32

Join Date: January 16, 2008

Recent Posts

I created a chart project "myfirstchart" using BIRT. I then use the directory "myfirstchart" were all the files were created
and made it into a zip file. I then uploaded the zip file and I got some errors. Again, I have problems understanding the
XML files in WEB-INF. My errors:

00:03:38,081 INFO [PluginPackageHotDeployListener:74] Reading plugin package for myfirstchart
00:03:38,081 WARN [PluginPackageHotDeployListener:123] Plugin package on context myfirstchart cannot be tracked because this WAR does not contain a liferay-plugin-package.xml file
00:03:38,362 INFO [PluginPackageHotDeployListener:187] Plugin package myfirstchart/myfirstchart/unknown/war registered successfully
00:03:38,378 INFO [PortletHotDeployListener:133] Registering portlets for myfirstchart
00:03:38,425 ERROR [HotDeployUtil:60] com.liferay.portal.kernel.deploy.hot.HotDeployException: Error registering portlets for myfirstchart
com.liferay.portal.kernel.deploy.hot.HotDeployException: Error registering portlets for myfirstchart
at com.liferay.portal.deploy.hot.PortletHotDeployListener.invokeDeploy(PortletHotDeployListener.java:431)
at com.liferay.portal.kernel.deploy.hot.HotDeployUtil._fireDeployEvent(HotDeployUtil.java:85)
at com.liferay.portal.kernel.deploy.hot.HotDeployUtil.fireDeployEvent(HotDeployUtil.java:42)
at com.liferay.portal.kernel.servlet.PortletContextListener.portalInit(PortletContextListener.java:45)
at com.liferay.portal.kernel.util.PortalInitableUtil.init(PortalInitableUtil.java:39)
at com.liferay.portal.kernel.servlet.PortletContextListener.contextInitialized(PortletContextListener.java:52)
at org.apache.catalina.core.StandardContext.listenerStart(StandardContext.java:3764)
at org.apache.catalina.core.StandardContext.start(StandardContext.java:4216)
at org.apache.catalina.startup.HostConfig.checkResources(HostConfig.java:1105)
at org.apache.catalina.startup.HostConfig.check(HostConfig.java:1203)
at org.apache.catalina.startup.HostConfig.lifecycleEvent(HostConfig.java:293)
at org.apache.catalina.util.LifecycleSupport.fireLifecycleEvent(LifecycleSupport.java:120)
at org.apache.catalina.core.ContainerBase.backgroundProcess(ContainerBase.java:1306)
at org.apache.catalina.core.ContainerBase$ContainerBackgroundProcessor.processChildren(ContainerBase.java:1570)
at org.apache.catalina.core.ContainerBase$ContainerBackgroundProcessor.processChildren(ContainerBase.java:1579)
at org.apache.catalina.core.ContainerBase$ContainerBackgroundProcessor.run(ContainerBase.java:1559)
at java.lang.Thread.run(Thread.java:619)
Caused by: java.lang.ClassNotFoundException: com.liferay.portlet.WAIFriendlyURLMapper
at org.apache.catalina.loader.WebappClassLoader.loadClass(WebappClassLoader.java:1362)
at org.apache.catalina.loader.WebappClassLoader.loadClass(WebappClassLoader.java:1208)
at com.liferay.portal.deploy.hot.PortletHotDeployListener.invokeDeploy(PortletHotDeployListener.java:196)
... 16 more


Maybe this means something to some of you experts and can tell me what it is?

thanks,

rotseN
Ricardo Uhalde
RE: Chart portlet
February 29, 2008 11:42 AM
Answer

Ricardo Uhalde

Rank: New Member

Posts: 9

Join Date: September 20, 2007

Recent Posts

The fastest and easiest way to code a portlet if you are a newbie, is to use Sun Java Studio Creator. Its all in there, a JSR168 portlet project, a Pluto portal container to debug your portlet, etc.

The only things you need to add to deploy that portlet inside Liferay are liferay-portlet.xml and liferay-display.xml, you can have info of those here in Liferay website.

To download SJSC you need to sign an account in Sun website here http://developers.sun.com/jscreator/downloads/, its free for members.
Rotsen Zerolf
RE: Chart portlet
March 3, 2008 8:08 AM
Answer

Rotsen Zerolf

Rank: Junior Member

Posts: 32

Join Date: January 16, 2008

Recent Posts

I will try that.

Gracias,

rotseN
Rotsen Zerolf
RE: Chart portlet
March 3, 2008 11:33 PM
Answer

Rotsen Zerolf

Rank: Junior Member

Posts: 32

Join Date: January 16, 2008

Recent Posts

I tried using Sun studio to create portlet and I did the tutorial where you can go from PortltPage1 to PortletPage2
but it did not work going to PortletPage2 but I was able to see PortletPage1. I did the same tutorial about
4 times and every time it did not go to the next PortletPage2. I can feel th ebig L of Looser in my forhead.

I will keep trying :-(
Victor Zorin
RE: Chart portlet
August 29, 2011 9:51 PM
Answer

Victor Zorin

Rank: Liferay Legend

Posts: 1176

Join Date: April 14, 2008

Recent Posts

Rotsen Zerolf:
Is there a sample portlet displaying pie charts where all we have to do is pluging our data.

I have been trying to create a portlet using Jfreechart but my knowledge of Java and portlets
creation is very bad.

Thanks,

rotseN


Simple to use Liferay portlet package is described at MyOffice24x7 BI Chart Portlets. It also uses JFreeChart for rendering. Deploy Pie Chart (2D or 3D) on your
page and point to a datasource XML file. Chart is re-rendered automatically when datasource file is modified.
Juan Fernández
RE: Chart portlet
April 26, 2009 2:09 PM
Answer

Juan Fernández

LIFERAY STAFF

Rank: Liferay Legend

Posts: 1235

Join Date: October 2, 2008

Recent Posts

Rotsen Zerolf:
Is there a sample portlet displaying pie charts where all we have to do is pluging our data.

Hi!
the best example in Liferay is the Poll portlet, which uses JFreechart and has a few diagrams to choose.
I hope it will be helpful

Greetings
Rice Owl
RE: Chart portlet
April 27, 2009 9:35 PM
Answer

Rice Owl

Rank: Regular Member

Posts: 177

Join Date: April 23, 2009

Recent Posts

Another option you could try is to use a servlet that outputs an image. Then in your JSP, you simply use the <img> tag, call the servlet, and it should render your graph. That way you can have a dynamically created chart fully integrated in your portlet.

The code for your servlet may look like:


1response.setContentType("image/png");
2JFreeChart myChart = .....;
3OutputStream output = response.getOutputStream();
4ChartUtilities.writeChartAsPNG(output, myChart, 100, 100);




So if you created a servlet called "MyGraphServlet", in your JSP code, you could simply use:

1<img src="<path to servlet>/MyGraphServlet">


You could even pass variables to the servlet if you needed to.

Rotsen Zerolf:
Is there a sample portlet displaying pie charts where all we have to do is pluging our data.

I have been trying to create a portlet using Jfreechart but my knowledge of Java and portlets
creation is very bad.

Thanks,

rotseN
Bill Hazard
RE: Chart portlet
May 15, 2009 4:51 PM
Answer

Bill Hazard

Rank: New Member

Posts: 1

Join Date: March 15, 2009

Recent Posts

Rotsen - I like the servlet suggestion. I recently discovered Google Chart API which provides an excellent set of features. So maybe you don't even need to write the servlet!
Bill
Ahmed Hasan
RE: Chart portlet
May 18, 2009 12:12 AM
Answer

Ahmed Hasan

Rank: Expert

Posts: 303

Join Date: April 13, 2007

Recent Posts

I agree with Bill,

With Google Chart API, we dont even need a servlet or an API like JFreeChart. We are implementing Google chart API in one of our projects. In the earlier version of the same project to generate the charts we were using JFreeChart. We see a huge saving in terms of time and effort using Google chart API. It is cool, handy and quite flexible.

For any help feel free to contact me,

Ahmed Hasan
CTO, TransIT mPower Labs (P) Ltd.
info@mpowerglobal.com
mPower Global Inc.
A Liferay expert company.
Rice Owl
RE: Chart portlet
May 20, 2009 9:59 AM
Answer

Rice Owl

Rank: Regular Member

Posts: 177

Join Date: April 23, 2009

Recent Posts

Rick, you are right, in order to generate charts you need to be able to call the Google APIs. So your server would need access. Like you said, this can be problematic in intranet portals that may be "locked down" or there could be privacy issues as well. A company may not want to post certain data to an external service and in some cases may not be legal (such as HIPAA issues for medical records).
Vijayalakshmi B
RE: Chart portlet
March 17, 2011 10:26 PM
Answer

Vijayalakshmi B

Rank: New Member

Posts: 1

Join Date: March 17, 2011

Recent Posts

Hi,

I need an example to create a portlet using JFree chart. How to render the chart generated on JSP page. Its urgent. Please help me. Thanks in advance

Viju
Dhandapani S
RE: Chart portlet
September 7, 2011 10:08 PM
Answer

Dhandapani S

Rank: Regular Member

Posts: 156

Join Date: March 24, 2009

Recent Posts

Hi Vijayalakshmi,

Why don't you use Google chart portlet, its very flexible compare to jfree chart.

Regards
Dhandapani S
Manikandan S
RE: Chart portlet
September 9, 2011 3:06 AM
Answer

Manikandan S

Rank: Expert

Posts: 492

Join Date: September 15, 2010

Recent Posts

Hi all you can get the war file of Jfreechart. Take it out and modify it as per your requirement.

And also this will helpful for people who wants to use Jfreechart in future
Attachments: JSR286ChartPortlet-portlet-5.2.3.1.war (4,429.6k)
Edi Wibowo
RE: Chart portlet
November 28, 2011 1:30 PM
Answer

Edi Wibowo

Rank: New Member

Posts: 1

Join Date: October 30, 2011

Recent Posts

Please see an example at https://www.ibm.com/developerworks/mydeveloperworks/blogs/portlet/entry/chart_portlet?lang=en

Regards,
Edi Wibowo
pruthvipatil raj
RE: Chart portlet
July 25, 2013 11:32 PM
Answer

pruthvipatil raj

Rank: New Member

Posts: 2

Join Date: May 10, 2013

Recent Posts

hello sir,

plz can you tell me how to do chart portlet in liferay.....