Re: two graphs in same window?

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


  • 2002 messages navigation, sorted by:
    1. Thread
    2. Subject
    3. Author
    4. Date
    5. ↑ Table Of Contents
  • Search the visad archives: