Shapes for bar diagramm


I'm trying to create a 2D display which make use of shapes
(VisADLineArray) to represent precipitation values (which are -
traditionally - drawn with bars). The point is, I have a math-type like

(year -> (day) -> (Nitrogen_Concentration, Precipitation,
Run-off_water,etc...) )

The data is shown in 2D displays. The days are along the x-axis, the
above values (Nitrogen, Precipitation, etc) in the y-axis, and for each
year there's a different display (or more precisely, for each year the
display is redrawn with values for that year).
Some of those values are drawn as points (I want to use here
VisADPoints), some as normal lines (that is, no shape) and precipitation
should be drawn like vertical bars (lines which I'll eventually make
thicker, like bars). (I think that's the "cheapest" way to represent
such a line: vectorize it.)

The problem is, I'm not sure when to set the line coordinates, as they
change for each year. For Nitrogen, for example, I have 

// samples array
samples_N_Sim= new float[1][LengthY];

// real types and sets 

RealType days =   new RealType( "day", null, null );
daySet = (Set) new Linear1DSet(  days  ,(float) firstDay, (float)
lastDay, LengthY);
RealType nitrate  =  new RealType( "N_", null, null );
FunctionType oFunc_N = new FunctionType(  days , nitrate );
// flat field and reference
ff_N_Sim = new FlatField( oFunc_N, daySet ); 
refer_N_Sim = new DataReferenceImpl("refer_N_Sim");
// year type, set and function

RealType year = new RealType( "Year", null, null );
RealTupleType time_type = new RealTupleType(year);
Set time_set = new Integer1DSet( args.length  );
FunctionType anTyp_N = new FunctionType(time_type, oFunc_N);
aFi_N_Sim = new FieldImpl(anTyp_N, time_set);

// here set the actual data...
// loop over years
for(int i = 0; i < args.length  ; i++){

// open data file
XArcGridReader dat1 = new XArcGridReader(args[i]);  
// get values, set samples      
samples_N_Real[0]  = dat1.getColumn(3);      
FlatField.setSamples( my_samples );     
FielImpl.setSample( i , FlatField );

// then do display.add(maps), references.setData(...) and

The question is: How can I combine the VisADLineArrays in this scheme,
so that for every different year I load a different coordinate array. (I
see that with "ordinary" data this is done with

aFi_N_Sim.setSample( i ,ff_N_Sim);

but it seems I don't have the slightest clue how to deal with the

I have adapted example 47, copied the code over to my programm but then
I noticed my mistake.

Final question: Can this be done for the lines like above? Does this
make sense, or is there a more appropriate way to do it?

Thanks for the patience!


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