srividya_sharma

FusionCharts with Seam

Recommended Posts

I m trying to use fusionCharts in my seam application. The simple examples using javascript are working perfectly . So , I tried to follow the steps provided by the moderator in this topic http://www.fusioncharts.com/forum/Topic8629-33-1.aspx. I have downloaded everything required for the application and also, have created a tld, required java files, updated the faces.config.xml , added the taglib to the xhtml file and possibly followed all the steps correctly. I doubt if I have missed out something very silly in the application or I must have placed the files in wrong directory. Can anyone tell me the correct way of integrating fusionCharts with Seam?It would be really helpful if you could guide me through all the required steps to ensure everything is perfect.

I m posting my xhtml code here

 

<?xml:namespace prefix = ui /><ui:composition <br xmlns="http://www.w3.org/1999/xhtml"> xmlns:s="http://jboss.com/products/seam/taglib"

xmlns:fc="http://www.fusioncharts.com"

xmlns:ui="http://java.sun.com/jsf/facelets"

xmlns:f="http://java.sun.com/jsf/core"

xmlns:h="http://java.sun.com/jsf/html"

xmlns:rich="http://richfaces.org/rich"

template="layout/template.xhtml">

 

 

<ui:define name="body">

 

 

 

<SCRIPT language=JavaScript src="FusionCharts/FusionCharts.js"></SCRIPT>

 

 

 

 

 

 

<H1>Welcome </H1>

<?xml:namespace prefix = rich /><rich:panel>

 

 

 

<!--<div id="SimpleChartDiv" align="center">

Chart.

</div>

<script type="text/javascript">

var chart_SimpleChart = new FusionCharts('FusionCharts/Column3D.swf', 'SimpleChart', '700', '300', '0', '0', '', '', '', '', '');

chart_SimpleChart.setDataURL("FusionCharts/Data.xml");

chart_SimpleChart.render('SimpleChartDiv');

 

 

</script>

 

 

 

-->

<?xml:namespace prefix = f /><f:verbatim>This is JSF example</f:verbatim>

 

 

<?xml:namespace prefix = fc /><fc:render registerWithJS="true" xml="#{exampleChartData.xml}" height="#{exampleChartData.height}" debugMode="on" width="#{exampleChartData.width}" filename="#{exampleChartData.filename}" chartId="#{exampleChartData.chartId}"></fc:render>

<fc:renderHTML xml="#{exampleChartData.xml}" height="#{exampleChartData.height}" debugMode="on" width="#{exampleChartData.width}" filename="#{exampleChartData.filename}" chartId="#{exampleChartData.chartId}"></fc:renderHTML>

 

 

 

 

 

</rich:panel>

 

 

 

</ui:define>

</ui:composition>

Edited by Guest

Share this post


Link to post
Share on other sites

Hi Sai,

Can you specify your folder structure with the relevant files, it will help us locate the problem.

Have you placed the FusionCharts JSF jar in the right location?

What is the version of JSF, jar and java are you using?

Srividya :)

Share this post


Link to post
Share on other sites

Thanks a lot for the reply Srividya!!

 

My doubt is , if I had placed them in wrong location , my code wouldnt have worked! I can see the text "This is JSF example" on my home screen and nothing else. What do you think could be the issue?

 

My folder structure is

 

lib

 

-->fusionchartstaglibJSF1_1.jar

 

-->fusionchartstaglibJSF1-2-java5.jar and all the relevant jsf jar files

 

resources

 

--> META-INF

 

-->fusioncharts.taglib.xml

 

-->application.xml, ejb-jar.xml and other files

 

-->WEB-INF

 

-->charts.tld

 

-->components.xml

 

-->components-dev.properties , faces-config.xml,web.xml, pages.xml

 

 

 

Another issue is I dont have a folder called web content and therefore , I couldn't find WebContent/WEB-INF/lib to place the jar files. I dont know if I am being silly as I am not that well-versed with Seam :) . Hope you understand the folder structure and help me to get out of this issue :)

Share this post


Link to post
Share on other sites

Hi Sai,

Thanks for the details of your application directory.

Please retain only one of the following files:

-->fusionchartstaglibJSF1_1.jar

-->fusionchartstaglibJSF1-2-java5.jar

and remove the other?

Please retain fusionchartstaglibJSF1-2-java5.jar  if you are using JSF 1.2.

Hope this helps. :)

Srividya.

Share this post


Link to post
Share on other sites

Hi Srividya ,

 

Thanks a lot for the reply. I did retain the fusionchartstaglibJSF1-2-java5.jar but its still not working. Though i cant find any errors in the server, I can only see the text " This is JSF example ". What else can I try?

Share this post


Link to post
Share on other sites

Hi Sai,

Since only the text is being shown and none of the JSF tags are getting rendered,

it has to be an issue with

1. Wrong FusionCharts JSF jar file

2. FusionCharts JSF jar not present in the correct path

Are you using JSF version 1.2 ?

Let me re-confirm that you have the Fusion Charts JSF jar in WEB-INF/lib folder ?

Srividya

Share this post


Link to post
Share on other sites

Hi Srividya ,

 

Thanks a lot for the reply. Well, Fusion Charts JSF jar is not in WEB-INF/lib folder. The lib folder is outside the WEB-INF and the jar file is in that lib folder. There is another lib folder whose heirarchy is as mentioned below

 

project -->exploded-archives-->project.ear-->project_war-->WEB-INF-->lib

 

 

 

Should I put the jar file inside the above mentioned lib folder? forgive my ignorance.:)

Share this post


Link to post
Share on other sites

Yes I suppose you should do that, (place the FusionCharts JSF jar within project_war WEB-inf/lib)  since I assume your xhtmls are also within the project_war.

I haven't tried out a SEAM application as such, but just guiding you based on other users' experience.

hope this works out. :)

Srividya

Share this post


Link to post
Share on other sites

Hi Srividya ,

 

Thanks a lot for the reply.

 

 

 

I tried that but in vain. :) What could be the reason? I tried out the simple chart example using avascript and it is working abs. fine. I am trying hard to figure out the issue,

 

 

 

I m trying to post the code here , but it doesn't show the complete code

Share this post


Link to post
Share on other sites

Hi Srividya,

 

Thanks a ton for being so patient with my silly questions! :)

 

 

 

I am extremely sorry for not posting the code as it is strictly against the company policies as we are working on a banking project. :)

 

 

 

I can understand that you haven't worked with Seam but I have seen you solving so many issues in the community. If you could help me giving rough ideas for solving this issue, it would have been really grateful.

 

 

 

It would have been great if others who have worked with Seam , could share their experiences :)

Share this post


Link to post
Share on other sites

Hi Srividya,

 

Amazing dear!! I duly admire your efforts to solve the issue! :).. I will download the file and work on it. I will get back to you once I try this.. Absolutely amazing , I have never seen a moderator of any community taking so much efforts to solve a newbie's issue :) ...kudos to you!! :)

Share this post


Link to post
Share on other sites

Hi Srividya,

 

 

 

Sorry...I was busy with some other work. Now that I m back with my fusion chart integration, I tried all the steps as per the guidelines you had mentioned in the file. But, Alas! It did not work as per expectations! The output seen on the screen is as mentioned below :-

 

 

 

 

 

 

Chart.

 

 

 

 

 

 

 

 

 

I know its been troublesome for you , but can you help me further to get my code working?

 

 

 

Thanks in advance

 

Sai

 

 

 

p.s :- How to post the code in the forum....I tried all the possible IFCode Shortcuts ...none seem to be posting my code here :)

Share this post


Link to post
Share on other sites

Hi Srividya,

 

 

 

First accept my apologies for not going through the steps carefully! :) . The steps did wonder for me...and I have successfully integrated fusion charts with my project :) :)...... Once again thanks for the efforts you took to resolve this issue :)

 

 

 

 

 

Hey another small doubt! Could you tell me in brief , the steps to make dynamic charts ,i.e values from the database ...!

 

 

 

Thanks in advance

 

Sai

Share this post


Link to post
Share on other sites

Hi all ,

 

Its pretty urgent! I am horribly stuck as I am trying to creat dynamic charts where the values are taken from the database. Getting the values from database can be achieved , but then to represent the values on the chart has been the main issue of concern,. Please , anyone with any rough idea would have been great.

 

 

 

I have defined a method in the backing bean which fetches all the active users in a list. My question is how to get the active users on the chart .. and the exact jsf and xml format to get the values !!

 

 

 

Its urgent guys! Fusioncharts , help me!! :)

Share this post


Link to post
Share on other sites

Hi,

 

 

 

Roughly the XML formats for various charts vary.

 

 

 

Still the common formats for all charts can be found from the pages from Online Documentation >> FusionCharts and XML section.

 

 

 

Direct Links:

 

 

 

http://www.fusioncharts.com/docs/Contents/XMLOverview.html

 

http://www.fusioncharts.com/docs/Contents/SingleSeries.html

 

http://www.fusioncharts.com/docs/Contents/MultiSeries.html

 

http://www.fusioncharts.com/docs/Contents/CombiXML.html

 

 

 

Please also note that Chart XML API section contains XML API of each chart present in FusionCharts v3 pack. For each chart you would get a sample XML that you can follow.

 

 

 

Please let me know which chart would like to implement so that I can specify the exact format.

 

 

 

You can also make use of the XSD posted in our forum : http://www.fusioncharts.com/forum/FindPost21264.aspx

Share this post


Link to post
Share on other sites

Hi Sai,

If I have understood your question correctly, this is what you would need to do:

Create a <chart> root element.

Iterate through the list of active users and for each item in the list, create a <set label='active username' value='value'/> element.

Close the chart element using </chart>

So finally your xml would look something like this:

<chart> 
<set label="user1" value="value1"/>
<set label="user2" value="value2"/>
...
</chart>

Just as Sudipto mentioned, the xml format varies for different chart types. The xml format given above is for single series chart.

Now, store this xml in backing bean and use it in the jsf page.

Hope this helps. :)

Srividya

Share this post


Link to post
Share on other sites

Hi Sudipto and Srividya,

 

I am absolutely spellbound seeing your dedication towards an issue.. With your support , I could successfully solve the issue :) ... As mentioned by you guys, I iterated a list of active and inactive users and displayed the correct number of active and inactive users and stored it in a string which represents the xml. And thats it... Fusion charts has made it so easy to display these beautiful charts on my screen :)

 

 

 

Kudos to you guys for extending your valuable support :)

 

 

 

And hey, if anyone working with seam is trying to integrate fusion charts and if there's any issue , Let me know....I would also love to help anyone in confusion like these guys helped me :)

Share this post


Link to post
Share on other sites
Guest Basundhara Ghosal

Hi Sai,

You are most welcome and thanks for your appreciation and kind words.

We are glad that your issue is resolved.:)

Also, we will definitely let you know if anyone faces this type of issues in future as we will be glad to see you as a support member for FusionCharts. :)

Share this post


Link to post
Share on other sites

Create an account or sign in to comment

You need to be a member in order to leave a comment

Create an account

Sign up for a new account in our community. It's easy!

Register a new account

Sign in

Already have an account? Sign in here.

Sign In Now