Hi Michael,

What kind of graphs are you going to be doing?

If nothing else you can use the Java 3d API, but it is probably overkill.

For simple line charts you could begin with an open source 2D package like
JFreeChart and write classes that extend the 2D classes.  You wouldn't need
to monkey with the source of the chart package, just extend its classes.

It is all going to be rendered in 2D anyway, so all you have to do is run
your x-y-z points through a simple equation that applies perspective and
spits out a translated  x-y point that you then graph with the 2D software
and connect the dots.

See the following for an explanation of this:

http://gamecode.tripod.com/tut/tut01.htm

The equation is pretty simple, it boils down to a projected 2D point (a, b)
from a 3D point (x, y, z) where:

a = eye.x + x * eye.z /(z+eye.z)
b = eye.y -  y * eye.z /(z+eye.z)

256 is a good value for eye.z , (eye.x, eye.y) is the viewpoint.  If you
make it zero you will be looking right down the z axis and won't see your z
axis.  You can let the user change this to see the graph from different
angles.

You would also need a routine to draw the third axis, or grid, on the chart,
but that is pretty straightforward.  Adding a label to the 3rd axis line
could get tricky, though.

JFreeChart uses the Java2D API and it has the ability to rotate text to an
arbitrary angle and scale it to an arbitrary size, but you would need to
rotate, translate, and scale each character of the Z axis label individually
to make it look right.

Unless the label is really long you may be able to get away with simply
rotating the 3rd axis label to the proper angle.

Go into the your JVM installation folder and go to the demo/jfc/Java2D
folder and run the demo to see some of the stuff you can do with the 2D API.


Rick


----- Original Message ----- 

> Hello,
>
> I've searched sourceforge.net to no avail. I was wondering if anyone
> here knows of a free/open source API to draw a (line) chart that
> supports three axises, X, Y and Z?
>
> Thanks
> Michael
>
>
> _______________________________________________
> Juglist mailing list
> [EMAIL PROTECTED]
> http://trijug.org/mailman/listinfo/juglist_trijug.org
>


_______________________________________________
Juglist mailing list
[EMAIL PROTECTED]
http://trijug.org/mailman/listinfo/juglist_trijug.org

Reply via email to