Re: two graphs in same window?

Thanks Bill,

Once again, that did the trick!

-Frank

At 10:45 AM 8/12/2002, Bill Hibbard wrote:
Hi Frank,

> I've been trying to get two graphs to show up in the same widget
> (Swing/Jython). I want to have two separate vertical axes (vertically
> displaced from one another), and two horizontal axes (again vertically
> displaced) with the same quantity and scale on each. Like this:
>
>          |
>    y     |
>          |
>          |
>          |-------------------------------------------
>                                x
>
>          |
>    y     |
>          |
>          |
>          |-------------------------------------------
>                                x
>
> Another example would be Ugo Taddei's  display at
> http://www.geogr.uni-jena.de/~p6taug/demviewer/more/modv.jpg, except that
> he's got three aligned vertically, though two of them do use the same
> horizontal axis. I had thought that using two displays, giving them the
> same horizontal ScalarMap, and adding them to the same Swing widget would
> accomplish that, but I get a message from VisAD about not being allowed to
> use the same ScalarMap on more than one display.

Instead of adding the same ScalarMap to two DisplayImpls,
construct two identical ScalarMaps and add each to only
one DisplayImpl. If they will have state changes, you can
keep them synced by adding ScalarMapListeners to them. But
be careful to avoid event loops between ScalarMapListeners
for two ScalarMaps - the easy way to do that is to never
call a method of a ScalarMap or Control that tries to set
it to a state that is identical to its current state.

Cheers,
Bill

PhD, Computational Biologist,
Harvard Medical School BCMP/SGM-322, 250 Longwood Ave, Boston MA 02115, USA.
Tel: 617-432-3555 Fax: 617-432-3557 http://llama.med.harvard.edu/~fgibbons