srividya_sharma

FusionCharts Struts2 Example

Recommended Posts

Hi All, :D

I have developed a small application to show the usage of FusionCharts in Struts2.

This example will show how to embed charts in the page, how to provide data to the chart from the action etc.

The example consists of 2 charts. ( Database and Drill down example )

The attached zip file contains all the files except the FusionCharts folder and the Struts2 jars.

Please follow the instructions in the readme file for setup.

Hope this is useful.

Please contact me in case you have any issues with this.

regards,

Srividya :)

FC-Struts2.zip

Edited by Guest

Share this post


Link to post
Share on other sites

Hello, Thanks for the Struts2 integration code. But I'm not able to get the expected result when I run this example. I've placed the necessary FusionCharts JS file and SWF file to FusionCharts folder. While running the application I'm seeing XMLString getting populaed but the frame shows "No Data to Display" Message. Please could you help me understand the issue.

 

 

 

Thanks again.

Share this post


Link to post
Share on other sites

Hi

Can you post the XML String that you are seeing. ( I assume that you have the database setup )

Also, it would help if you turn on the debug mode to see any error messages.

Srividya

Edited by Guest

Share this post


Link to post
Share on other sites

Here's the XML being generated.

 

 

 

<chart caption='Factory Output report' subCaption='By Quantity' pieSliceDepth='30' showBorder='1' formatNumberScale='0' numberSuffix=' Units' animation='1'><set label='Factory 1' value='644' link='Detailed.action?FactoryId=1' /><set label='Factory 2' value='2644' link='Detailed.action?FactoryId=2' /><set label='Factory 3' value='1252' link='Detailed.action?FactoryId=3' /></chart>

 

 

 

I set the debug mode to 'true' , but how this will help in debug (where can I see the debug info on setting this to 'true')

 

 

 

Also, I'm seeing the following error in Tomcat logs, will it make any difference ?

 

 

 

AbandonedObjectPool is used (org.apache.tomcat.dbcp.dbcp.AbandonedObjectPool@10dbef1)

 

LogAbandoned: false

 

RemoveAbandoned: true

 

RemoveAbandonedTimeout: 30

 

 

 

Please help.

Edited by Guest

Share this post


Link to post
Share on other sites

Okay....found the problem. <chart> :crazy: tag is the real culprit here, I changed the DAO's to return XML as <graph> now everything looks fine.

 

 

 

 

 

ThankQ :)

Edited by Guest

Share this post


Link to post
Share on other sites

Hi

Good that you could figure out the problem.

FusionCharts Free uses <graph> tag whereas FusionCharts v3 uses <chart> tag and v3 also has several attributes which are not present in free version.

FusionCharts v3 introduces a debug mode for each chart. The debug mode helps you to look into what's happening in the chart behind the scenes. You can see how the chart is initializing, getting its data and interacting with JavaScripts. Various errors generated are also shown in this. So, whenever you see an error on the chart now, all you need to do is switch to debug mode and fix it up. --- from the documentation

Srividya

Share this post


Link to post
Share on other sites

Hi

You are most welcome. I am really happy to know that you have been using the JSF tag library and are finding the Struts2 example also useful.

Gives me motivation to contribute more to the forums. :)

Srividya

Share this post


Link to post
Share on other sites

Hi everybody,

I did the tutorial(struts2 + fusionCharts); but using FusionCharts free download; so I created a directory named FusionCharts inside web directory and put all files found in FusionChartsFree\Code\FusionCharts

fom the free distribution inside the FusionCharts directory .

But it didn't work.

Please, can you tell me exactly what modification I must bring to your code to make it work with FusionChartFree?

Best Regards,

Kwame

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