OFC for Smartgwt

I develop an application using Smartgwt. Just one thing that is missing in it - chart. I decided to write my own implementation of Open Flash Chart(http://ofc2dz.com/) for smartgwt using flashlet and then put it somewhere(e.g. googlecode). But first of all I want to ask: Is there any ready implementations? Why is Smartgwt have no its own implementation of any chart?(licence, any other points of view)

It seems I finally finished my work, but still want to know about my question

I’ve packed initial version of OFC chart for Smartgwt. It is based on ofcgwt 2.0.1 beta, but uses Smartgwt’s Flashlet. All you need to use it - is

<inherits name="com.smartgwt.ofcchart.OFCChart4SGWT"/>

, import jar in classpath and use like it ofcgwt.

For todo: I want to implement work with Datasource

Here the jar file http://dl.dropbox.com/u/690921/OFCChart4SGWT-1.0.jar

Good to see

Hi,

Good to see this.
This gives us an alternative to GWT Visualization.

Do you have some code samples etc.., connected with this…or is it pretty easy to put together..

Cheers
Strawman

I’ll try to put some of the samples, but you can watch samples for GXT http://www.extjs.com/examples/#chartgallery, except data binding.

Have you seen this? http://www.smartclient.com/#gridCharting

This is part of SmartClient, only a java wrapper is missing, and then it can be incorporated into SmartGWT. (Would be nice.)

Do you mean a wrapper that can be conveniently used in SmartGWT, or is it really a new implementation (ie. a complete rewrite from stracth)?

I don’t think it’s a good idea to put your independent code in SmartGWT’s NameSpace (com.smartgwt); that’s contrary to the universally accepted Naming Convention of java.

(See http://java.sun.com/docs/codeconv/html/CodeConventions.doc8.html#367)

You should place your own packages in your own namespace.

I’ve got a problem in using OFC for Smartgwt.

I’ve downloaded jar file, provided by Metallic and added it to my project.
Then added an “inherits” record in my .gwt.xml file.

<?xml version="1.0" encoding="UTF-8"?>
<module rename-to='webarm'>
  <inherits name='com.google.gwt.user.User'/>
  <inherits name='com.smartgwt.SmartGwt'/>
  <inherits name="com.smartgwt.SmartGwtPluginBridges"/>
  <inherits name="com.smartgwt.ofcchart.OFCChart4SGWT"/>

  <inherits name='com.google.gwt.user.theme.standard.Standard'/>

  <extend-property name="locale" values="ru_RU"/>

  <entry-point class='com.tenzor.webarm.client.WebARM'/>

  <source path='client'/>
</module>

Here’s the code I’ve written in “onModuleLoad” method:

LineChart lc = new LineChart();
lc.addValues(1, 2, 4, 8, 16, 32);
lc.addDots(new Dot(1),new Dot(2),new Dot(4),new Dot(8),new Dot(16),new Dot(32));
        
ChartData cd = new ChartData();
cd.addElements(lc);
        
ChartWidget cw = new ChartWidget();
cw.setWidth100();
cw.setHeight100();
        
cw.setChartData(cd);
        
Window w = new Window();
w.addChild(cw);
w.setCanDragResize(true);
w.setCanDrop(true);
w.show();
        
HLayout dock = new HLayout();
dock.setCanAcceptDrop(true);
        
RootPanel.get().add(dock);

So, after all this operations, when I run the server and navigate to it with my browser, I receive errors:

No source code is available for type com.smartgwt.ofcchart.client.model.elements.LineChart; did you forget to inherit a required module?
No source code is available for type com.smartgwt.ofcchart.client.model.elements.dot.Dot; did you forget to inherit a required module?
No source code is available for type com.smartgwt.ofcchart.client.model.ChartData; did you forget to inherit a required module?
No source code is available for type com.smartgwt.ofcchart.client.ChartWidget; did you forget to inherit a required module?

So, what can cause that errors?
I’m using GWT 2.0.3, SmartGWT 2.2, Firefox 3.5.7

P.S. Sorry for my bad english :slight_smile:

I’ve improved my project http://dl.dropbox.com/u/690921/OFCChart4SGWT-1.0.jar If it help somebody - I will create project on googlecode

PS Now you should inherit <inherits name=“ua.metallic.ofcchart.OFCChart4SGWT”/>

I think it would be very useful to add this to google code. Other enhancements worth exploring are making the Chart’s directly support databinding with DataSource’s. That would be quite powerful.

Sanjiv

I’ve posted initial version to http://code.google.com/p/ofc4sgwt/, later I’ll try to investigate and implement DataSource compatibility. Any help is appreciated.

nice!

what do i have to do to get the “Save Image Locally” option to work?

or can you include it into your project?

edit: tooltips do not disappear, when i move the mouse over to another area in my application than the chart!?

I temporary froze my work on this project, next week I plan to implement “Save image locally” feature, add DataSource compatibility and patch chart to remove tooltip(if it not hovers the point)

sounds good…

trying to get it working on my own until then…

I’ve found solution for tooltip: need to set tooltip style for chartdata -

chartData.setTooltipStyle(new ToolTip(ToolTip.MouseStyle.NORMAL));

working fine, thanks.

any way to let me save the graph as an image will make me hapyy :wink:

I’ve added “Save image locally” feature. By default new modal window with chart image will be shown. But You can customize this window by changing ChartWidget.getSaveImageWindow() properties. You can checkout latest trunk from googlecode(http://code.google.com/p/ofc4sgwt/ ) or download binary from http://dl.dropbox.com/u/690921/OFCChart4SGWT-1.0.jar

Waiting for comments

Hi,

Any suggestions as to what needs to be changed to get this to work with SmartGWTPro?

I have changed the <inherits… in OFC4SGWT.gwt.xml but it still seems to be referencing smartgwt since the app now complains about not being to access server side datasources, ie when you run the app it tells you to use smartgwtpro, not smartgwt.

TIA

Andreas

I’ve never worked with SmartGWT Pro, but OFC4SGWT have no datasource support for now. May be this is the reason of your problem?