JSF Chart Creator Component Based on JFreeChart
MyFaces Integration
Hi
I have tried new version and not been able to resolve the issues with the MyFaces integration.
Would appreciate any help, suggestions etc.
As a workaround I am currently using Cewolf's tag library for displaying the charts in my JSF app.
Cheers
Seamus
I have tried new version and not been able to resolve the issues with the MyFaces integration.
Would appreciate any help, suggestions etc.
As a workaround I am currently using Cewolf's tag library for displaying the charts in my JSF app.
Cheers
Seamus
-
- Posts: 54
- Joined: Sun Aug 28, 2005 8:13 pm
Hi Maha,
can you post your solution so we can all see it, you said about an entry for the managed bean in the faces-config, can you post the entry example, is it the entry of the component or the backing bean of the page? So the problem is not related with the myFaces:) The component supports 10 charts but no overlaid charts. Can you show me an example of an overlaid chart, let me see if it is possible to support:)
can you post your solution so we can all see it, you said about an entry for the managed bean in the faces-config, can you post the entry example, is it the entry of the component or the backing bean of the page? So the problem is not related with the myFaces:) The component supports 10 charts but no overlaid charts. Can you show me an example of an overlaid chart, let me see if it is possible to support:)
Two charts on one page
Hi, first of all thanks a lot for developing this very useful component !!
I have question: Is it somehow possible to display two different charts on one page? I've tried this:
<%@ 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" %>
<html>
<f:view>
<c:chartCreator id="charter1"
title="Chart 1"
datasource="#{dataSource.categorySource}"
type="stackedbar"
is3d="true"
background="white"></c:chartCreator>
<c:chartCreator id="charter2"
title="Chart 2"
datasource="#{dataSource.pieSource}"
type="pie"
is3d="true"
background="white"></c:chartCreator>
</f:view>
</html>
The problem is that the second chart is displayed twice..
Any advice??
Cheers
I have question: Is it somehow possible to display two different charts on one page? I've tried this:
<%@ 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" %>
<html>
<f:view>
<c:chartCreator id="charter1"
title="Chart 1"
datasource="#{dataSource.categorySource}"
type="stackedbar"
is3d="true"
background="white"></c:chartCreator>
<c:chartCreator id="charter2"
title="Chart 2"
datasource="#{dataSource.pieSource}"
type="pie"
is3d="true"
background="white"></c:chartCreator>
</f:view>
</html>
The problem is that the second chart is displayed twice..
Any advice??
Cheers
-
- Posts: 54
- Joined: Sun Aug 28, 2005 8:13 pm
Hi shaggy,
I have tried two charts on a single page and as you said, the last chart is displayed, and the others are overwritten. The img is created by a chart servlet which looks at the session to get the attributes. Since the last chart's configuration is at the session, the servlet gives the same chart. I don't know if I can take care of this situtation but I will give it a try, thanks for reporting this:)
Çağatay Çivici
www.jroller.com/page/cagataycivici
I have tried two charts on a single page and as you said, the last chart is displayed, and the others are overwritten. The img is created by a chart servlet which looks at the session to get the attributes. Since the last chart's configuration is at the session, the servlet gives the same chart. I don't know if I can take care of this situtation but I will give it a try, thanks for reporting this:)
Çağatay Çivici
www.jroller.com/page/cagataycivici
cagatay great initial component but I improved it a little
I've been watching this post mainly because it always comes up when you search for jsf chart. cagatay you should really consider open source this project. I had to reverse engineer it to add stuff.... Sorry... anyway I rewrote how it passes parameters to your servlet in order to be able to display more then one chart in a page... I can send you java files if need be here is what I did.
In UICharter.java
Then in doGet in ChartWriter servlet to get the values back...
This allows as many charts as you want on a page as long as you define unique id's...
Anyway sorry about reversein your code but I figured I could help. I also made a few other enhancements to allow xydataset/time chart creation... post a reply if you have any questions.
Again great job so far hope this helps.
-Chris
In UICharter.java
Code: Select all
String id = (String)getAttributes().get("id");
Object datasource = getAttributes().get("datasource");
if(datasource != null)
session.put(id, datasource);
String title = (String)getAttributes().get("title");
String type = (String)getAttributes().get("type");
String width = (String)getAttributes().get("width");
String height = (String)getAttributes().get("height");
String background = (String)getAttributes().get("background");
String xAxisLabel = (String)getAttributes().get("xAxisLabel");
String yAxisLabel = (String)getAttributes().get("yAxisLabel");
String orientation = (String)getAttributes().get("orientation");
writer.write("<IMG SRC=\"" + projectName + "/servlet/ChartWriter?id="+id+"&title="+title+"&height="+height+"&width="+width+"&type="+type+"&orientation="+orientation+"&background="+background+"\" BORDER=1 WIDTH=" + width + " HEIGHT=" + height + "/>");
Code: Select all
HttpSession session = request.getSession();
String title = request.getParameter("title");
String sWidth = request.getParameter("width");
String sHeight = request.getParameter("height");
String type = request.getParameter("type");
String background = request.getParameter("background");
String xAxisLabel = request.getParameter("xAxisLabel");
String yAxisLabel = request.getParameter("yAxisLabel");
String orientation = request.getParameter("orientation");
String id = request.getParameter("id");
Object datasource = session.getAttribute(id);
session.removeAttribute(id);
Anyway sorry about reversein your code but I figured I could help. I also made a few other enhancements to allow xydataset/time chart creation... post a reply if you have any questions.
Again great job so far hope this helps.
-Chris
-
- Posts: 54
- Joined: Sun Aug 28, 2005 8:13 pm
Hi Chris,
Actually you read my mind, in order to resolve this issue I've thought of a way that uses the request param instead of session param, the question annoying me was passing the datasource in the servlet url, I see that you solved this problem by giving a unique id to the session variable, what I think? Great solution
Another thing is I am very very busy now, my time is shared by my job and another JSF component called "JSF Client Side Validators", JSF has no client side validations support so I have implemented a series of validator components to validate at client side. Since we have the solution now thanks to you Chris, I will change the code and add some new charts in the new version, which will come soon because I am almost finished with the validator components I mentioned. I think next week I will distribute the "open source" new version of "JSF Chart Creator".
Thanks for participating in the development,
Çagatay Çivici
Actually you read my mind, in order to resolve this issue I've thought of a way that uses the request param instead of session param, the question annoying me was passing the datasource in the servlet url, I see that you solved this problem by giving a unique id to the session variable, what I think? Great solution

Thanks for participating in the development,
Çagatay Çivici
Re: File "/WEB-INF/tld/chartCreator.tld" not found
satishbytes wrote: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
xxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxand my java bean is hereCode: 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>
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.
xxx
PS: early response is appreciated..
-
- Posts: 54
- Joined: Sun Aug 28, 2005 8:13 pm
-
- Posts: 54
- Joined: Sun Aug 28, 2005 8:13 pm
Hi everybody,
The new version of the JSF Chart Creator is coming soon, here are some new features;
* The component now supports a total of "27" charts.
* Anti-aliasing feature is added to the component.
* The bug that prevents more than one chart to be displayed is corrected. Now the users can display any number of charts.
I will distribute the component on my blog soon when I am finished with the testing;
The new version of the JSF Chart Creator is coming soon, here are some new features;
* The component now supports a total of "27" charts.
* Anti-aliasing feature is added to the component.
* The bug that prevents more than one chart to be displayed is corrected. Now the users can display any number of charts.
I will distribute the component on my blog soon when I am finished with the testing;
Hi again,
The new version 1.1 is out now, here is the supported chart list;
Pie Charts
3D Pie Charts
Bar Charts
Stacked Bar Charts
3D Bar Charts
3D Stacked Bar Charts
Area Charts
Stacked Area Charts
Line Charts
3D Line Charts
Waterfall Charts
Time Series Charts
XYLine Charts
Polar Charts
Ring Charts
Scatter Charts
XYArea Charts
XYStep Area Chart
XYStep Charts
Bubble Charts
Candle Stick Charts
Gantt Charts
Box and Whisker Charts
High and Low Charts
Histogram Charts
Signal Charts
Wind Charts
The new version also supports antialiasing and the more than one chart display issue is corrected. The new version can be found at;
http://www.jroller.com/page/cagataycivi ... rt_creator
The new version 1.1 is out now, here is the supported chart list;
Pie Charts
3D Pie Charts
Bar Charts
Stacked Bar Charts
3D Bar Charts
3D Stacked Bar Charts
Area Charts
Stacked Area Charts
Line Charts
3D Line Charts
Waterfall Charts
Time Series Charts
XYLine Charts
Polar Charts
Ring Charts
Scatter Charts
XYArea Charts
XYStep Area Chart
XYStep Charts
Bubble Charts
Candle Stick Charts
Gantt Charts
Box and Whisker Charts
High and Low Charts
Histogram Charts
Signal Charts
Wind Charts
The new version also supports antialiasing and the more than one chart display issue is corrected. The new version can be found at;
http://www.jroller.com/page/cagataycivi ... rt_creator
-
- Posts: 54
- Joined: Sun Aug 28, 2005 8:13 pm
Chartcreator 1.1 works on WL 8.1.4 with JSF 1_1_01
Hello
Just for your information, I tried the component V 1.1 on WebLogic 8.1 SP4 with the JSF Reference Implementation from Sun (V 1.1.01).
Everything seems to work fine.
Regards, Leo
Just for your information, I tried the component V 1.1 on WebLogic 8.1 SP4 with the JSF Reference Implementation from Sun (V 1.1.01).
Everything seems to work fine.
Regards, Leo
chartCreator not found
Hello cagatay_civici,
My applicaiton is running under WSAD 5.1.2 and I have followed all the instructions on the doc, copy the three jars files under WEB-INF/lib and I have created the Managed Bean.
But the application just doesn't work.
your help is highly appreciated
Thanks
Lin
here is the error msg
WebGroup E SRVE0026E: [Servlet Error]-[Expression Error: Named Object: 'chartCreator' not found.]: javax.faces.FacesException: Expression Error: Named Object: 'chartCreator' not found.
here is my simple JSP file.
<%@ taglib uri="http://java.sun.com/jsf/core" prefix="f" %>
<%@ taglib uri="http://java.sun.com/jsf/html" prefix="h" %>
<%@ taglib uri="/WEB-INF/tld/chartCreator.tld" prefix="c" %>
<f:view>
<c:chartCreator id="charter1" title="EXAMPLE CHART"
datasource="#{helloBean.pieSource}" type="pie" is3d="yes"
background="white"></c:chartCreator>
</f:view>
My applicaiton is running under WSAD 5.1.2 and I have followed all the instructions on the doc, copy the three jars files under WEB-INF/lib and I have created the Managed Bean.
But the application just doesn't work.
your help is highly appreciated
Thanks
Lin
here is the error msg
WebGroup E SRVE0026E: [Servlet Error]-[Expression Error: Named Object: 'chartCreator' not found.]: javax.faces.FacesException: Expression Error: Named Object: 'chartCreator' not found.
here is my simple JSP file.
<%@ taglib uri="http://java.sun.com/jsf/core" prefix="f" %>
<%@ taglib uri="http://java.sun.com/jsf/html" prefix="h" %>
<%@ taglib uri="/WEB-INF/tld/chartCreator.tld" prefix="c" %>
<f:view>
<c:chartCreator id="charter1" title="EXAMPLE CHART"
datasource="#{helloBean.pieSource}" type="pie" is3d="yes"
background="white"></c:chartCreator>
</f:view>