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!
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.
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.
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?
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/).
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:
Download com_rednels_ofcgwt_callback.js and swfobject.js
Create flash object in DOM by swfobject.embedSWF (swfobject.js)
Download open-flash-chart.swf
Load JSON data from remote server
Call open flash chart javascript API to render data
ofcvaadin render workflow:
Download a small piece of code of Embedded command
Vaadin execute the command in client site to create flash object in DOM
Download open-flash-chart.swf
Load JSON data file from remote server
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
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!