EasyCharts Applet

I am in need of a complex chart for my client and I recently discovered EasyCharts ( http://www.objectplanet.com/easycharts/ ), a much touted charting applet, which seems to have complex charts just for my needs.

I have successfully gotten it to show up in Servoy 2.2.1rc3 but I can’t get it to change from the blank default it arrives with. I’m using sample code they provide on their website, and converting it to Servoy method language. Can anyone get me started, or over this first hurdle…

Using the sample code they provided at:
http://www.objectplanet.com/easycharts/ … imple.html

I’ve written a method for their BarChartApplet called cx on my form which says the following, but nothing happens:

elements.cx.setParameter('chart', 'bar')
elements.cx.setParameter('sampleValues', '10,20,40,65,50')
elements.cx.setParameter('sampleColors', '#FF7310')
elements.cx.setParameter('range', '70')
elements.cx.setParameter('background', 'white')

Help?

ellen

See attached – I got it to half work, but as you can see it appears I have two beans sitting on the form. Problem is, I don’t. I discovered that my method (posted above) was working when I resized the bean and saw orange bars below what appeared to be a foreground bean. I’ve deleted the bean several times and re-added it – just one. I tried creating a new form and adding this applet to it just once, and it does this.

I’m on a mac without Java 1.5 – could it be that? Where do i get Java 1.5 btw? Can’t find it on apple or sun’s website…

Same exact issue on Windows XP.

Hi Ellen,

Java 1.5 is also known as java 5, which is a bit confusing, try:

http://www.apple.com/support/downloads/ … ease1.html

Also, you need to use some trick to get Servoy to actually use Java 1.5, there are instructions somewhere else on the forum…

Looks like a great bean you’ve found. Will try it out in the next few days.

ellenmeserow:
Same exact issue on Windows XP.

I think it’s just an artifact of the DEMO version?

I’ve had some success with the EZ Charts demo libs.

I would double check with the Servoy guys, but placing an Applet in a form might be the cause of many problems. Obviously the demo version banner will go away with the real Easy Charts version, but the “doubled-up” look seems to be a problem with resizing the applet.

The trick is to add just the chart components as beans and not the Applets. The trouble is the chart components themselves do not automatically appear in the Insert Bean list. I checked the Manifest File for the EZ Chart jars and found that none of the classes are marked as being “Java-beans”. Therefore, Servoy doesn’t recognize them as such(and I don’t know why it sees applets as beans…).

I built another jar with my own manifest file and flagged all the chart classes as beans. Then I was able to add the various charts from the beans list. The strange display problem goes away. From the method editor you can still programatically manipulate their content and appearence. This also allows for direct method calls on the chart objects, circumventing the need for more cumbersome “setParameter” methods of the applets.
Hope this helps,
-Sean

Sean… it sounds like you’ve made this work – in EasyCharts, the exact software I need. Can we talk? I need to very quickly get a Complex Overlay Chart working in EasyCharts, and I don’t know how to write my own manifest file to make the charting components work with Servoy…

My email is ellen@meserow.com and I’d be really interested in talking further on this.

ellen

p.s. Servoy team still needs to look at the resize of an applet in 2.2.1rc3 no?

ellenmeserow:
p.s. Servoy team still needs to look at the resize of an applet in 2.2.1rc3 no?

Do you mean to anchor an applet/bean ?
I haven’t tried it with applets yet but with beans you anchor them by using the right-click (control-click for 1 button mouse on Mac OS X).
Then you get a menu to (de-)select the anchors.

Hope this helps.

Anchoring didnt fix the problem, but thanks!

try this once:

elements.cx.setParameter(‘chart’, ‘bar’)
elements.cx.setParameter(‘sampleValues’, ‘10,20,40,65,50’)
elements.cx.setParameter(‘sampleColors’, ‘#FF7310’)
elements.cx.setParameter(‘range’, ‘70’)
elements.cx.setParameter(‘background’, ‘white’)
elements.cx.validate();
elements.cx.repaint();

ObjectPlanet confirmed this is not caused by the demo edition… Help… Sean, still want to discuss if you’re available to consult.

Hi all,

This my experience so far:

Downloaded EasyCharts.
Dropped the chars.jar into the “beans” directory in Servoy.

Restarted Developer.
Added bean to form, named it cx.

Tried Ellens code, but nothing shows.
Tried Johan’s code, but the bean is still blank apart from a scale from 0 to 100 on the left side.

Servoy Developer
Version R2 2.2.1rc3-build 332
Java version 1.4.2-54 (Mac OS X 10.4.2)

They (the makers of the chart beans/applets) have to update there jar.
They have to include:

Name: com/objectplanet/chart/BarChart.class
Java-Bean: True

And then that last line. (java-bean)

i changed it:
http://downloads.servoy.com/downloads/b … /chart.jar

then don’t place the Applet but the: BarChart on the form.
then use this code:

var values = new Array(10,20,40,65,50);
var c = new Array(new java.awt.Color(0xFF7310));
elements.cx.sampleCount = 5;
elements.cx.setSampleValues(0, values);
elements.cx.sampleColors = c;
elements.cx.background = java.awt.Color.white;
elements.cx.setRange(0, 70);

then it works.

I will check out why the applet with setParameters don’t work out of the box.

But do remember this is what we call a heavy weight component (awt) not a swing component. Those can cause drawing problems.

Johan,
I see that you can instantiate a new Color object in the method editor using one of its constructors. However, I tried to do the same with the BarChart using its construtor and the JS Compiler didn’t like it. My question is: Is it possible to call the contructor of any Java Class through from the method editor or does it work only for the libraries of the JRE?

If I wanted to use the overlay functionality of the chart app, I have to add two components to the form in order to get a reference to the chart bean objects in the method editor via forms.elements. But I do not want those input charts to be visible on the form. I just need to programmitcally manipulate them and add them to the overlay. Because they are components, I called setVisible(false) as a workaround. But is there a more elegant way?

Thanks,
Sean

yes this is possible for everything but you have to use the Package keyword:

http://forum.servoy.com/viewtopic.php?p=23713#23713

Johan:

This doesn’t seem to work - even with build 333. Using the EasyCharts “beans” the line:

var overlay1 = new Package.com.objectplanet.chart.LineChart();

returns an error that “Package” is undefined. This error occurs both in developer and in client.

Any idea what we’re doing wrong, or is this functionality still not functioning?

Oh! Just discovered that the keyword is Packages, not Package, so the line:

var overlay1 = new Packages.com.objectplanet.chart.LineChart();

works.