NOTICE: This version of the NSF Unidata web site (archive.unidata.ucar.edu) is no longer being updated.
Current content can be found at unidata.ucar.edu.
To learn about what's going on, see About the Archive Site.
Forgot to cc: the list -------- Original Message -------- Subject: Re: 2 questions about visaAD Date: Mon, 13 Aug 2001 15:59:11 -0600 From: Don Murray <dmurray@xxxxxxxxxxxxxxxx> Organization: Unidata/UCAR To: Chen Zhang <CZhang@xxxxxxxxxxxxxxx> References: <AD41FD390AC1D111BF1E00805F6FE65B0582C7E8@xxxxxxxxxxxxxxxxx> Hi Chen Zang- There are no methods in AxisScale for doing this. It is currently way down on the list of things to do, so won't happen any time soon. However, there is usually more than one way to skin a cat. You could create a UnionSet of Gridded2DSets with manifold dimension 1, where each Gridded2DSet would define the endpoints of the lines running from one end of the graph to the other. Then you would create a DataReference, add the UnionSet to the reference and then add the reference to the display. So, if your RealTypes were XAxis and YAxis and you wanted lines horizontally along the display (up the YAxis every N values), you could do something like: double[] xrange = xScalarMap.getRange(); float ymin = (float) yScalarMap.getRange()[0]; RealType xy = new RealType(RealType.XAxis, RealType.YAxis); Gridded2DSet[] lineSets = new Gridded2DSet[numLines]; for (int i = 0; i < numLines, i++) { float[][] points = new float[2][2]; // 2 xy points for a line float yValue = (float) yrange[0] + i*N // y value for this line float[0][0] = (float) xrange[0]; // X value at 1st point (min X) float[1][0] = yValue; // Y value at 1st point float[0][1] = (float) xrange[1]; // X value at 2nd point (max X) float[1][1] = yValue; // Y value at 2nd point lineSets[i] = new Gridded2DSet(xy, points); } UnionSet lines = new UnionSet(xy, lineSets, 2); (I haven't checked the code, but you should get the idea). You could do a similar thing for the Y values. I do this to draw lat/lon lines on a map. You could also use an array of ConstantMaps when you add in the reference to make the lines a specific color. Don Murray Chen Zhang wrote: > > thank you for your prompt reply. > > is it possible to draw grid lines in a 2D graph for Y axis? now, i am able > to set customized scale for Y axis. i need to draw lines across the graph > to make reading easier. > > thanx. > cz ************************************************************* Don Murray UCAR Unidata Program dmurray@xxxxxxxxxxxxxxxx P.O. Box 3000 (303) 497-8628 Boulder, CO 80307 http://www.unidata.ucar.edu/staff/donm *************************************************************
visad
archives: