JSF Chart Creator Component Based on JFreeChart

A discussion forum for JFreeChart (a 2D chart library for the Java platform).
Locked
Guest

Post by Guest » Wed Sep 28, 2005 4:24 am

First let me tell you that this product is great and worked right out of the box for me. Thanks for providing us with it. Any way to create 3d pie charts and some of the other chart available in JFreeChart?

cagatay_civici
Posts: 54
Joined: Sun Aug 28, 2005 8:13 pm

Post by cagatay_civici » Wed Sep 28, 2005 4:47 pm

Hi, I am very happy that you liked it. First of all, creating 3d pie charts is not included in the first version, I am planning to include the 3d ones this weekend and hopefully the second version will support them. Other chart types will also be supported in the next versions. Also I think there is a problem with the myFaces integration. IBM implementation works fine.

p.s. First thing to figure out is to find a stable way to upload the chart creator library to internet. Any thoughts? The project has an account in sourceforge but I must learn how to upload files to sourceforge cvs.

Thanks for the appreciation again:)It gives enthusiasm.

Guest

Great product!

Post by Guest » Sun Oct 02, 2005 12:48 am

I agree too. I think it's a very good product. Cannot wait to see more charts capabilites.
Mona

fbouck

error on chartcreator.ChartWriter.doGet()

Post by fbouck » Wed Oct 05, 2005 9:34 am

I'm testing it in a Portlet environment but I get an error.

I'm using Rational Application Developer for Websphere as IDE.
and use WebSphere Portal 5.1 Test Environment

Made de changes in faces-config.xml and web.xml as mentioned in the manual (with the corrections mentioned in this forum)

the columncount and rowcount are shown correctly in the JSF
so, I presume the DataSource is filled correctly. I only get a blank area whe the graph shoud be

Code: Select all

Servlet Error]-[ChartWriter]: java.lang.NullPointerException
	at java.lang.Throwable.<init>(Throwable.java)
	at java.lang.Throwable.<init>(Throwable.java)
	at java.lang.NullPointerException.<init>(NullPointerException.java:61)
	at chartcreator.ChartWriter.doGet(ChartWriter.java:46)
	at javax.servlet.http.HttpServlet.service(HttpServlet.java:740)
	at javax.servlet.http.HttpServlet.service(HttpServlet.java:853)
	at com.ibm.ws.webcontainer.servlet.StrictServletInstance.doService(StrictServletInstance.java:110)
	at com.ibm.ws.webcontainer.servlet.StrictLifecycleServlet._service(StrictLifecycleServlet.java:174)
	at com.ibm.ws.webcontainer.servlet.IdleServletState.service(StrictLifecycleServlet.java:313)
	at com.ibm.ws.webcontainer.servlet.StrictLifecycleServlet.service(StrictLifecycleServlet.java:116)
	at com.ibm.ws.webcontainer.servlet.ServletInstance.service(ServletInstance.java:283)
	at com.ibm.ws.webcontainer.servlet.ValidServletReferenceState.dispatch(ValidServletReferenceState.java:42)
	at com.ibm.ws.webcontainer.servlet.ServletInstanceReference.dispatch(ServletInstanceReference.java:40)
	at com.ibm.ws.webcontainer.webapp.WebAppRequestDispatcher.handleWebAppDispatch(WebAppRequestDispatcher.java:1038)
	at com.ibm.ws.webcontainer.webapp.WebAppRequestDispatcher.dispatch(WebAppRequestDispatcher.java:603)
	at com.ibm.ws.webcontainer.webapp.WebAppRequestDispatcher.forward(WebAppRequestDispatcher.java:204)
	at com.ibm.ws.webcontainer.srt.WebAppInvoker.doForward(WebAppInvoker.java:125)
	at com.ibm.ws.webcontainer.srt.WebAppInvoker.handleInvocationHook(WebAppInvoker.java:286)
	at com.ibm.ws.webcontainer.cache.invocation.CachedInvocation.handleInvocation(CachedInvocation.java:71)
	at com.ibm.ws.webcontainer.srp.ServletRequestProcessor.dispatchByURI(ServletRequestProcessor.java:182)
	at com.ibm.ws.webcontainer.oselistener.OSEListenerDispatcher.service(OSEListener.java:334)
	at com.ibm.ws.webcontainer.http.HttpConnection.handleRequest(HttpConnection.java:56)
	at com.ibm.ws.http.HttpConnection.readAndHandleRequest(HttpConnection.java:615)
	at com.ibm.ws.http.HttpConnection.run(HttpConnection.java:439)
	at com.ibm.ws.util.ThreadPool$Worker.run(ThreadPool.java)

Guest

Post by Guest » Wed Oct 05, 2005 3:39 pm

Hi, the component is tested with Tomcat, the cause of the problem might be websphere. Let me figure out the reason, it seems at line 46, there occurs a null pointer exception. I will post a possible solution after I have checked that line.

cagatay_civici
Posts: 54
Joined: Sun Aug 28, 2005 8:13 pm

Post by cagatay_civici » Wed Oct 05, 2005 7:51 pm

It is the line where the type attribute of the chart is used, if you do not give a type then it will throw a null pointer exception.

cagatay_civici
Posts: 54
Joined: Sun Aug 28, 2005 8:13 pm

Post by cagatay_civici » Wed Oct 05, 2005 8:13 pm

Also there is an issue with the orientation, if it is not given then the chart is not displayed. I will correct it in the new version. And here are some screenshots that has a 3d attribute. In the new version there is a new attibute calls "is3D". When it is set true, the charts will be in 3D format.

ImageImageImage

fbouck

WebSphere

Post by fbouck » Thu Oct 06, 2005 6:50 am

After I posted the message I created a new JSF project in Rational but not as a portlet project. and it works with the sample data from the manual. now try to get it to work with database data and in a portlet, since that is the purpose of my testing. getting graphs into a portlet. When will the new version be available?

Guest

Post by Guest » Thu Oct 06, 2005 12:45 pm

There is even another component family that wrap jfreechart in a jsf component family, here is the link:
http://www.jenia.org/jsp/chart.jsf

bye

cagatay_civici
Posts: 54
Joined: Sun Aug 28, 2005 8:13 pm

Post by cagatay_civici » Fri Oct 07, 2005 7:13 pm

Hi, the new version is coming next week coming with new charts, fixed bugs and 3d charts. Also the component is added to www.jsftutorials.com main page which has a link to this forum.

cagatay_civici
Posts: 54
Joined: Sun Aug 28, 2005 8:13 pm

NEW VERSION OF JSF CHART CREATOR

Post by cagatay_civici » Sun Oct 09, 2005 12:27 pm

Hi,

The new version is out now, now the component supports a total of "10" charts, chart orientations, 3d charts and more. I have created a page for the component in my blog. All the details, screenshots, manuals and more can be found at;

http://www.jroller.com/page/cagataycivici

Çağatay Çivici

cagatay_civici
Posts: 54
Joined: Sun Aug 28, 2005 8:13 pm

Post by cagatay_civici » Sun Oct 16, 2005 9:28 am

Hi, I made some small changes;

Here are the current supported charts

Supported Charts
----------------------
* Pie Charts
* 3D Pie Charts
* Bar Charts
* Stacked Bar Charts
* 3D Bar Charts
* 3D Stacked Bar Charts
* Line Charts
* 3D Line Charts
* Area Charts
* Stacked Area Charts

at:
http://www.jroller.com/page/cagataycivi ... rt_creator

satishbytes

File "/WEB-INF/tld/chartCreator.tld" not found

Post by satishbytes » Tue Oct 18, 2005 11:27 am

Hello cagatay_civici,

i am eagerly waiting to get this graph done...but the problem goes so..

javax.servlet.ServletException: java.lang.ClassNotFoundException: chartcreator.ChartWriter
javax.faces.webapp.FacesServlet.service(FacesServlet.java:125)


I got the above problem when i tried to acces the linechart.jsp file which containing the below code

Code: Select all

<%@ page language="java" %>
<%@ taglib uri="http://java.sun.com/jsf/html" prefix="h" %>
<%@ taglib uri="http://java.sun.com/jsf/core" prefix="f" %>
<%@taglib uri="/WEB-INF/tld/chartCreator.tld" prefix="c" %>
<!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.01 Transitional//EN">
	
	
	<f:view>
	 	<c:chartCreator id="charter1" title="EXAMPLE CHART"
			       datasource="#{DBMgrChartcreator.source}"
			       type="line"
			       orientation="VERTICAL" 
                               background="white">
        </c:chartCreator>
	</f:view>
and my java bean is here




Code: Select all

import org.jfree.*;
import org.jfree.data.category.DefaultCategoryDataset;
import org.jfree.data.general.DefaultKeyedValueDataset;


public class DBMgrChartcreator  
{
	public DefaultCategoryDataset getChartcretor() throws Exception
	{
        String series1 = "A";
        String series2 = "B";
        String series3 = "C";
        //column keys...
        String category1 = "1990";
        String category2 = "1995";
        String category3 = "2000";
        String category4 = "2005";

		DefaultCategoryDataset source = new DefaultCategoryDataset();
		
		source.addValue(1 , series1, category1);
        source.addValue(2 , series1, category2);
        source.addValue(2.3 , series1, category3);
        source.addValue(3.2 , series1, category4);
        
        source.addValue(2.1 , series2, category1);
        source.addValue(3.5 , series2, category2);
        source.addValue(2 , series2, category3);
        source.addValue(4.5 , series2, category4);
        
        source.addValue(6 , series3, category1);
        source.addValue(4 , series3, category2);
        source.addValue(2 , series3, category3);
        source.addValue(5.3 , series3, category4);
       
        return source;
	}

}

i declared the bean in faces-config.xml file and also the component as u mentioned in the documentation...

even added the below code to web.xml file




Code: Select all

 <servlet>
        <servlet-name>ChartWriter</servlet-name>
        <servlet-class>chartcreator.ChartWriter</servlet-class>
    </servlet>
    <servlet-mapping>
        <servlet-name>ChartWriter</servlet-name>
        <url-pattern>/servlet/ChartWriter</url-pattern>
    </servlet-mapping> 
 

and copied the all of the jars to lib and also to classpath..

its not serlvet project but its an EJB project... and i get the above error... saying it cant find the class chartcreater
javax.faces.FacesException: java.lang.ClassNotFoundException: chartcreator.ChartWriter

and even the tag is also not detected..

thanku verymuch for providing these kind of tags for free...

looking forward...
Satish, Germany.

PS: early response is appreciated..

Maha

Displays blank chart

Post by Maha » Mon Oct 24, 2005 7:08 pm

Hi,
ANy updates on the issue reported by Seamus & Bruce? I seem to have the same issue - the chart is displayed with title & borders, but no figure / data.

Thanks,
Maha

cagatay_civici
Posts: 54
Joined: Sun Aug 28, 2005 8:13 pm

Post by cagatay_civici » Tue Oct 25, 2005 4:39 pm

Hi, are you using myFaces implementation of JSF? Again, I have never tried the component with myFaces, but I will try very very soon:)

Locked