Hi,
Because of security reasons I don't have a place to put
things on the web site in my institute. So put the prototype
of my wrapper classes in
http://www.geocities.com/qomo/visad/
I am putting them on the web hoping someone will find them
useful and hoping I can collect suggestions. There are
functionalities
that I haven't had time to implement, and I am a hundred percent
sure there are better ways to implement how the plots are made.
If you can borther to try it, read the JavaDocs and even browse
through the source code (I hope they are easy readings) and make
suggestions I will be very grateful.
Anyone can use these code for non-commercial purposes provided
the copyright notices are included. At the moment
I don't have the time to stick one of the GNU lisences in it
and if there are other credit notices I didn't include
but I should please let me know. It's a "what-do-you-think?"
release that is not to any formal extend.
I will be traveling starting from this weekend until next
January, during which I might not have much time working on them.
If you find anything in it actually useful, it's what I give
back to the helpful VisAD community. It's my intention
that this package can give general users one more choice
to use VisAD.
here is the equally quick and dirty 00Readme.txt
This package is a quick and dirty prototype. It is an attempt to make
it easy for java programmers and end users to make X-Y style line
plot,
and to control the rendation of the plot, using VisAD.
To put it in plain terms, the plotter accepts multiple "plottable"
objects,
each of which can have multiple Y values and one set of X values. If
you
only have one set of X values, the plotter can directly accept the X
and
Y arrays without requiring you to make the plottable object first (it
makes an internal one for you).
1) To install:
You need to down load VisAD jar at
ftp://ftp.ssec.wisc.edu/pub/visad-2.0/visad.jar
Put the jar file on your local system if you don't have one
already, and put the file name with its full path in your CLASSPATH
environment variable.
see VisAD home page at www.visad.org for more details on
installation.
2)
compile it by
javac *.java
3)
a) run the Example. It's a mini demo. To run it type:
java herschel.spire.qla.plot.Example
and look at the screen after the window pops out and press <enter>
when it asks.
b) to play with it in Jython (or VisAD's Jython editor):
type this in Jython command line (I use ">>>" for the Jython prompt):
>>>from java.awt import Color
>>>from visad import *
first, if you don't have anything to plot, this plotter will make
some junk data
to plot for you, just for testing.
>>> p=PlotVisAD2D()
you can play with it: (see javeDoc of PlotVisAD2D for more options)
for example:
>>> p.setBackgroundColor(Color.yellow)
There are many more things (about 18 so far) you can set. you need to
look at the javaDocs for PlotControlVisAD2D.java . Note some part
(e.g.
the direct manipulation ) haven't been implemented.
You can plot some data with a one-liner
>>> p=PlotVisAD2D([0,1,3,4,6],[[4,2,2,3.5,0]],"foo",["bar"])
or a more relaxed
>>> x = [0,1,3,4,6]
>>> d0 = [4,2,2,3.5,0]
>>> d1 = [1,0,1,0,2]
>>> p=PlotVisAD2D(x,[d1, d2],"foo",["bar"],boxColor=Color.orange)
Note that after "bar" the name of the data set d1 is not given. "Y1"
is used.
If you see setXXX()/getXXX() method pairs in PlotControlVisAD2D.java,
you can use
xXX (lower case for the first letter) like how the "boxColor" is
used.
Of course you can also do like
>>> p.setBoxColor(Color.red)
after the plot is constructed.
To control the scale rendation, you need to first get the
ScaleControl for that
axis.
At this point it's better to look at the source code of Example.java
to figure out. It's all quite simple, for example in Example.java
there are
these lines:
ScaleControlVisAD2D sc1 = p2.getYScaleControl(0,0);
...
sc1.setSnapToBox(false);
so in Jython you can, after making a plot called "p" above,
>>> sc1 = p.getYScaleControl(0,0)
>>> sc1.setSnapToBox(0);
the "0,0" in getYScaleControl() is for the "plottable" id, and the Y
id in that
plottable. They all count from 0.
To control an individual data line (a pair of X and Y data set), you
get
the control of it e.g.
>>> lc = p.getLineControl(0,0)
then do something like
>>> lc.setLineWidth(2.0f)
Almost anything can be changed programtically (like in Example.java)
can be changed
in Jython.
4) note that I haven't implemented drawing data points for each data
sets at the moment.
Maohai Huang
Dec 6, 2002
__________________________________________________
Do you Yahoo!?
Yahoo! Mail Plus - Powerful. Affordable. Sign up now.
http://mailplus.yahoo.com