Due to the current gap in continued funding from the U.S. National Science Foundation (NSF), the NSF Unidata Program Center has temporarily paused most operations. See NSF Unidata Pause in Most Operations for details.
On Sat, 8 Feb 2003, Bill Hibbard wrote: > Hi Carlos, > > > I have 4 different series, I have been able to graph the four series in > > the same display with different colors. But I would like to add a simple > > box with a legend indicating each color meaning. I don't know how to do > > this. > > One way to make the box is as a RealTuple with MathType > (x, y, s) and ScalarMaps x -> XAxis, y -> YAxis and > s -> Shape. Create the box as a VisADLineArray that > you pass to the setShapes() method of the ShapeControl > you get from the getControl() method of your ScalarMap > to Shape. See visad/examples/Test47.java for an example. To get a colored box, accoridng to a ScalarMap to RGB that you want to document, construct a RealTuple with MathType (x, y, c, s) where c is the RealType in your existing ScalarMap to RGB. Instead of a VisADLineArray, use a VisADQuadArray to make a filled box. Don't set any array in the VisADQuadArray's .colors variable, so that the ScalarMap c -> RGB will determine color. Instead of the ScalarMap to Shape, you could also use a Tuple with MathType (c, Set(x, y)) and "draw" your box as a Linear2DSet. Bill
visad
archives: