PrimeFaces charts on Mac OS

UI Components for JSF
GiriGG
Posts: 12
Joined: 16 Jun 2009, 01:25

16 Jun 2009, 01:51

Hi,

I am trying to use PrimeFaces charts with the below environment:
OS: Mac OS X 10.5.6
App Server: JBoss 4.2.2
Web Framework: Rich Faces & Prime faces (0.8.3/0.9.0)
I am trying to run the example code given for Pie Chart on http://code.google.com/p/primefaces/wiki/Charts
Part of the JSF code is as follows:
<%@ taglib uri="http://primefaces.prime.com.tr/ui" prefix="p"%>
<body>
<f:view>
<table style="width: 309px; height: 107px; margin-left: auto; margin-right: auto;"
cellpadding="5" cellspacing="0" border="0" _base_target="_top"><tr><td colspan="2">
<br></td></tr>
<h:form>
<p:pieChart value="#{PrimeBean.sales}" var="sale" categoryField="#{sale.brand}" dataField="#{sale.amount}" />
</h:form>
</table>
</f:view>
</body>

Chart is not displaying and I am getting a Java script error as Error: YAHOO is not defined. Am I missing some jar file?
I am also planning to use prime faces for generating line chart, pie chart, bar chart & live line chart. Please let me know if there are any issues/limitations

Thanks in Advance,
Girish

cagatay.civici
Prime
Posts: 18616
Joined: 05 Jan 2009, 00:21
Location: Cybertron
Contact:

16 Jun 2009, 10:17

Hi Girish, welcome to the forum,

I use a mac also and I can say it's the environment that's tested with most :). It seems you're missing the p:resources component on your page. Quick start page or the Reference Documentation can help if you ran into issues like this.

Just place <p:resources /> between your <head /> tags. And since you're using jsp dont forget to enclose the p:resources with f:view as well.

GiriGG
Posts: 12
Joined: 16 Jun 2009, 01:25

16 Jun 2009, 17:19

Hi Cagatay,

Thanks for the response.
I got the below error when I add <p:resources/> in head & f:view.
java.lang.NullPointerException org.primefaces.ui.component.resources.ResourcesTag.setProperties(ResourcesTag.java:35)

I have added following jars for primefaces.
primefaces-ui-0.8.3-sources.jar
primefaces-ui-0.8.3.jar
slf4j-jcl-1.5.8.jar
slf4j-api-1.5.8.jar

<body>
<head>
<p:resources/>
</head>
<f:view>
<p:resources/>
<table style="width: 309px; height: 107px; margin-left: auto; margin-right: auto;"
cellpadding="5" cellspacing="0" border="0" _base_target="_top"><tr><td colspan="2">
<br></td></tr>
<h:form>
<p:pieChart value="#{PrimeBean.sales}" var="sale" categoryField="#{sale.brand}" dataField="#{sale.amount}" />
</h:form>
</table>
</f:view>
</body>

cagatay.civici
Prime
Posts: 18616
Joined: 05 Jan 2009, 00:21
Location: Cybertron
Contact:

16 Jun 2009, 17:20

Yes, that's what I mentioned in my previous post.
And since you're using jsp dont forget to enclose the p:resources with f:view as well.

GiriGG
Posts: 12
Joined: 16 Jun 2009, 01:25

16 Jun 2009, 17:29

Hi Cagatay,

Soory, I think I am missing some points here. I have already enclosed in <p:resources/> in head & f:view tags and getting the error as java.lang.NullPointerException org.primefaces.ui.component.resources.ResourcesTag.setProperties(ResourcesTag.java:35).
What exactly I need to do here?

Regards,
Girish

cagatay.civici
Prime
Posts: 18616
Joined: 05 Jan 2009, 00:21
Location: Cybertron
Contact:

16 Jun 2009, 17:40

Your page doesn't enclose p:resources within f:view, here's the code you sent.

Code: Select all

<body>
//f:view must be here
<head>
<p:resources/>
</head>
<f:view>
<p:resources/>
<table style="width: 309px; height: 107px; margin-left: auto; margin-right: auto;"
cellpadding="5" cellspacing="0" border="0" _base_target="_top"><tr><td colspan="2">
<br></td></tr>
<h:form>
<p:pieChart value="#{PrimeBean.sales}" var="sale" categoryField="#{sale.brand}" dataField="#{sale.amount}" />
</h:form>
</table>
</f:view>
</body>

GiriGG
Posts: 12
Joined: 16 Jun 2009, 01:25

16 Jun 2009, 19:27

Hi,

I have changed the code as below and now there are no Java/JSP error. But still chart is not displaying and getting a java script error as Error: YAHOO is not defined... :? :?

<body>
<f:view>
<head>
<p:resources/>
</head>
<table style="width: 309px; height: 107px; margin-left: auto; margin-right: auto;"
cellpadding="5" cellspacing="0" border="0" _base_target="_top"><tr><td colspan="2">
<br></td></tr>
<h:form>
<p:pieChart value="#{PrimeBean.sales}" var="sale" categoryField="#{sale.brand}" dataField="#{sale.amount}" />
</h:form>
</table>
</f:view>
</body>

Regards,
Girish

cagatay.civici
Prime
Posts: 18616
Joined: 05 Jan 2009, 00:21
Location: Cybertron
Contact:

16 Jun 2009, 20:42

Ok, so do you have ResourceServlet defined?

GiriGG
Posts: 12
Joined: 16 Jun 2009, 01:25

16 Jun 2009, 23:27

Hi,

You are right. ResourceServlet was removed while testing some other functionality and also I had styleClass="line" style="chartStyle". But did not had chartStyle script.

It is working now in FireFox after fixing these issues in my code. But still chart is not displaying on Safari. Safari version is 3.2.1

<p:lineChart id="bamDataqq" value="#{BAMSearchBean.births}" var="birth" xfield="#{birth.year}"
live="true" refreshInterval="3000" >
<p:chartSeries label="Boys" value="#{birth.boys}" />
</p:lineChart>

Thanks,
Girish

cagatay.civici
Prime
Posts: 18616
Joined: 05 Jan 2009, 00:21
Location: Cybertron
Contact:

16 Jun 2009, 23:31

Hi Girish,

Ok, we're making progress:) So can you see the piechart on online demo?

http://primefaces.s156.eatj.com/prime-s ... eChart.jsf

I'm on mac with safari 4, it's working fine. It was fine with 3.x as well before updating my safari.

Post Reply

Return to “PrimeFaces”

  • Information
  • Who is online

    Users browsing this forum: No registered users and 57 guests