Open Flash Chart

Hi!
I’m quite new to Java and Vaadin and I’ve been trying to play around with Vaadin a bit.
I wanted to include Open Flash Charts to my application and since there was no ready component, I decided to implement one myself. I understood from the new component tutorials that implementing a gwt widget isn’t too hard with Vaadin.

However I ran to some problems while trying to get ofcgwt (Open Flash Chart for Google Web Toolkit).
I tried to only bind the main widget class to Vaadin but it didn’t work. So my question is that is there any other way to integrate ofc to Vaadin than doing a Vaadin counterpart for every class in the ofcgwt library?

By the way, Vaadin is great and beginner friendly!

Santtu


ofcgwt

OFCGWT seems to be an interesting library - I really hope that you can integrate it with Vaadin and share the results.

I am not familiar with the library, but a quick look to API gives me a feeling that the options are: 1) duplicate the API on server-side or 2) design a higher level server-side API.

If you select the first option, it would really benefit the whole community, but obviously there is quite a lot to do.

If you have some specific application in mind, the latter option could be better. You could use OFCGWT on client-side to build larger, high-level components that have some client-side functionality (like drilling) and provide application specific high-level API on server-side.

Whichever option you will select - I am sure that everyone here is really interested in hearing about the results.

I’ll try the first option and let you know if I get anything worthwhile done.

If you would like to have commit access to do the development in incubator, just let me know.

Well I got the first chart working. It’s a pie!
Adding additional charts shouldn’t take as much time.
And yeah, commit acces to Incubator would be appreciated.

We want demo!

(sending incubator commit access to you asap)

Ofcgwt has LGPL license, so should I put both it and Apache license to my project?

Putting both LGPL and Apache -licenses would probably be the easiest choice. If possible, you should select to user LGPL 3 instead of LGPL 2.

Can anyone provide a link to the working example of integrating ofcgwt with vaadin?

Thanks

It seems that
http://dev.vaadin.com/svn/incubator/ofc/
has not been updated in 9 months. Thus I would not be surprised if there would be some potholes on the road to get it to work nicely with the latest Vaadin version. Have you tried it out?

I have created an open source project named "
ofcvaadin
" on google code. You can see the demo http://ofcvaadin.appspot.com/

Junping,

I will check it out. I have spent time trying to use the one in incubation. You approach from what I see is much straightforward. I will let you know.

Thanks

I have problems getting it working. The page loaded but got the error message movie not found. My war had the following:

/WEB-INF/lib/ofcvaadin.jar
/WEB-INF/lib/vaadin.jar
/META-INF
/ofc/open-flash-charts.swf

Any ideas?

I have tried the incubator code that Joonas provided and found out that the custom widget renders faster that the pure vaadin implementation.

I am not sure exactly why but still looking into it but may have something to do with the animated way the ofcvaadin chart shows up.

Let me know if you have any thoughts …

Thanks for trying:)
Your configuration is almost correct. The bug part maybe: You’re using the root path (/) as vaadin servlet url-pattern, which makes “/ofc/open-flash-charts.swf” not accessable to external site. One quick fix is to use a different path as your vaadin application path (such as /myapp/).

  <servlet-mapping>
  	<servlet-name>Demo Application</servlet-name>
  	<url-pattern>/*</url-pattern>
  </servlet-mapping>

The working config in the Demo application (vaadin application path is /demo/*):

  <servlet>
  	<servlet-name>Demo Application</servlet-name>
  	<servlet-class>com.vaadin.terminal.gwt.server.ApplicationServlet</servlet-class>
  	<init-param>
  		<description>Vaadin application class to start</description>
  		<param-name>application</param-name>
  		<param-value>org.ofcvaadin.demo.DemoApplication</param-value>
  	</init-param>
  </servlet>
  <servlet-mapping>
  	<servlet-name>Demo Application</servlet-name>
  	<url-pattern>/demo/*</url-pattern>
  </servlet-mapping>

I have added more instructions to the home site
http://code.google.com/p/ofcvaadin/
.

For performance:
I haven’t tried code that Joonas provided. Is it based on
ofcgwt
?
I have done some investigation on ofcgwt. It mainly rely on the javascript API of Open Flash Chart. In ofcgwt demo, its JSON data is generated in client side, not fetching from server. So it looks much faster. If the data is from server side (real applications fetch data from server side), it will be much slower.

ofcgwt render workflow:

  1. Download com_rednels_ofcgwt_callback.js and swfobject.js
  2. Create flash object in DOM by swfobject.embedSWF (swfobject.js)
  3. Download open-flash-chart.swf
  4. Load JSON data from remote server
  5. Call open flash chart javascript API to render data

ofcvaadin render workflow:

  1. Download a small piece of code of Embedded command
  2. Vaadin execute the command in client site to create flash object in DOM
  3. Download open-flash-chart.swf
  4. Load JSON data file from remote server
  5. Open Flash Chart render itself when JSON data is downloaded

From the above workflows, we can see ofcvaadin dowload speed would be faster than ofcgwt.

The current ofcvaadin implementation doesn’t take advantage of Open Flash Chart javascript API. Each time ofcvaadin chart refreshes, it needs to destroy the flash object in DOM and create a new one. This would be a performance drawback of ofcvaadin. I have tried to use the javascript API to load JSON data, but I met some compatability issue on IE browser :frowning:

Actually
the code
is written by Santtu Mikkonen - not met. And I have not taken a look of it either.

As you say - using OFC JavaScript API would probably speed up the updates a lot.

in openchart with ofcvaadin and jofc2, can we give format for x axis or y axis, like we can do that in jfreechart lib?

Hey,
I managed to get OFCVaadin working with no problems at all. Great Work!
Your code allowed me to structure my code so that charts can simply be dropped in as plugins, as such I really appreciate what you have done. However, other than the drop in charts feature, my project requires the charts to be auto refreshed as well.

I tried to do this by adding some setInterval javascript to the OpenFlashChartV2 object. No matter what javascript method I called, I couldn’t get the auto update to work. Also, it seems that a lot of the javascript that reads the json and updates the chart doesn’t appear till the refresh button is clicked.

Is there any way to force an auto update? I don’t need it to be frequent at all, every 5 minutes or even every 15 minutes will be fine. There are however many charts (much like your All Charts demo) each in a Vaadin Window of it’s own. Is there any way your code can be extended to force an update after an X interval? I can hack the flex code as well if that will help.

I’m using Vaadin 6.3
Java 1.6
OFC V2 (Version 2 Lug Wyrm Charmer)
And ofcourse the latest OFCVaadin from the site.

Thanks in advance for any help.

— UPDATE —
I found the
Refresher
thread on this post. It helped me solve the problem. An other great project!

hi ,

how can i create 3D bar chart in ofc vaadin