Thanks Bill, but I think that I'm doing something wrong this is my code:
time = RealType.getRealType("time");// ,SI.second,null);
tempHalley = RealType.getRealType("Kelvin",SI.kelvin,null);
tempRothera = RealType.getRealType("Rothera",SI.kelvin,null);
tempBird = RealType.getRealType("Bird",SI.kelvin,null);
tempSouthPole = RealType.getRealType("South_Pole",SI.kelvin,null);
// Create FunctionType, that is the class which represents our
functions
// This is the MathType ( time -> temperature )
// Use FunctionType(MathType domain, MathType range)
func_time_tempHalley = new FunctionType(time, tempHalley);
func_time_tempRothera = new FunctionType(time, tempRothera);
func_time_tempBird = new FunctionType(time, tempBird);
func_time_tempSouthPole = new FunctionType(time, tempSouthPole);
int rows=aValues.getRows();
time_set = new Integer1DSet(time, rows);
// Those are our actual temperature values
// Note the dimensions of the array:
// float[ number_of_range_components ][ number_of_range_samples]
float[][] tempHalley_vals =new float[1][rows];
tempHalley_vals[0]=aValues.getColumnAsFloat(2);
//System.out.println("Halley"+ArrayUtils.floatArrayStringValue(tempHalley_vals[0]));
float[][] tempRothera_vals = new float[1][rows];
tempRothera_vals[0]=aValues.getColumnAsFloat(3);
//System.out.println("Rothera="+ArrayUtils.floatArrayStringValue(tempRothera_vals[0]));
float[][] tempBird_vals = new float[1][rows];
tempBird_vals[0] = aValues.getColumnAsFloat(1);
//System.out.println("Bird
Island="+ArrayUtils.floatArrayStringValue(tempBird_vals[0]));
float[][] tempSouthPole_vals = new float[1][rows];
tempSouthPole_vals[0] = aValues.getColumnAsFloat(4);
//System.out.println("SouthPole="+ArrayUtils.floatArrayStringValue(tempSouthPole_vals[0]));
// Create a FlatField, that is the class for the samples
// Use FlatField(FunctionType type, Set domain_set)
valsHalley = new FlatField( func_time_tempHalley, time_set);
valsRothera = new FlatField( func_time_tempRothera, time_set);
valsBird = new FlatField( func_time_tempBird, time_set);
valsSouthPole = new FlatField( func_time_tempSouthPole, time_set);
// and put the temperature values above in it
valsHalley.setSamples( tempHalley_vals );
valsRothera.setSamples( tempRothera_vals );
valsBird.setSamples( tempBird_vals );
valsSouthPole.setSamples( tempSouthPole_vals );
// Create Display and its maps
// A 2D display
display = new DisplayImplJ2D("display1");
GraphicsModeControl dispGMC = (GraphicsModeControl)
display.getGraphicsModeControl();
dispGMC.setScaleEnable(true);
// Create the ScalarMaps: quantity time is to be displayed along x-axis
// and height along y-axis
// Use ScalarMap(ScalarType scalar, DisplayRealType display_scalar)
timeMap = new ScalarMap( time, Display.XAxis );
tempHalleyMap = new ScalarMap( tempHalley, Display.YAxis );
tempRotheraMap = new ScalarMap( tempRothera, Display.YAxis );
tempBirdMap = new ScalarMap( tempBird, Display.YAxis );
tempSouthPoleMap = new ScalarMap( tempSouthPole, Display.YAxis );
tempRotheraMap.setScaleEnable(false);
tempBirdMap.setScaleEnable(false);
tempSouthPoleMap.setScaleEnable(false);
tempHalleyMap.setScaleEnable(true);
float min=aValues.getFloatMin()-10.0f;
//System.out.println("MIN="+min);
int[] validColumns={1,2,3,4,};
float max=aValues.getFloatMax(validColumns)+10.0f;
//System.out.println("MAX="+max);
tempHalleyMap.setRange(min,max);
tempRotheraMap.setRange(min,max);
tempBirdMap.setRange(min,max);
tempSouthPoleMap.setRange(min,max);
// Add maps to display
display.addMap( timeMap );
display.addMap( tempHalleyMap );
display.addMap( tempRotheraMap );
display.addMap( tempBirdMap );
display.addMap( tempSouthPoleMap );
axisScale=new AxisScale(tempHalleyMap);
axisScale.setTitle("Celsius");
//axisScale.setAutoComputeTicks(false);
axisScale.setAutoComputeTicks(false);
axisScale.createStandardLabels((double)10,(double)-50,(double)1,(double)5);
//System.out.println("tickBase="+axisScale.getTickBase());
axisScale.setMinorTickSpacing((double)1);
axisScale.setMajorTickSpacing((double)5);
axisScale.setTickBase((double)1);
axisScale.setLabelAllTicks(true);
axisScale.setSide(axisScale.SECONDARY);
// Color for the lines.
float rotheraRed = 1.0f;
float rotheraGreen = 1.0f;
float rotheraBlue = 0.0f;
float birdRed = 0.0f;
float birdGreen = 1.0f;
float birdBlue = 1.0f;
float southPoleRed = 0.0f;
float southPoleGreen = 1.0f;
float southPoleBlue = 0.0f;
float[] rotheraColor = new float[]{rotheraRed, rotheraGreen,
rotheraBlue};
tempRotheraMap.setScaleColor(rotheraColor);
// Create constantMap to put colors
ConstantMap[] rotheraCMap = { new ConstantMap( rotheraRed,
Display.Red),
new ConstantMap( rotheraGreen,
Display.Green),
new ConstantMap( rotheraBlue,
Display.Blue),
new ConstantMap( 1.50f,
Display.LineWidth)};
ConstantMap[] birdCMap = { new ConstantMap( birdRed, Display.Red),
new ConstantMap( birdGreen, Display.Green),
new ConstantMap( birdBlue, Display.Blue),
new ConstantMap( 1.50f, Display.LineWidth)};
ConstantMap[] southPoleCMap = { new ConstantMap( southPoleRed,
Display.Red),
new ConstantMap( southPoleGreen,
Display.Green),
new ConstantMap( southPoleBlue,
Display.Blue),
new ConstantMap( 1.50f,
Display.LineWidth)};
// Create a data reference and set the FlatField as our data
data_refHalley = new DataReferenceImpl("data_refHalley");
data_refRothera = new DataReferenceImpl("data_refRothera");
data_refBird = new DataReferenceImpl("data_refBird");
data_refSouthPole = new DataReferenceImpl("data_refSouthPole");
data_refHalley.setData( valsHalley );
data_refRothera.setData( valsRothera );
data_refBird.setData( valsBird );
data_refSouthPole.setData( valsSouthPole );
// Add reference to display
display.addReference( data_refHalley );
display.addReference( data_refRothera, rotheraCMap );
display.addReference( data_refBird, birdCMap );
display.addReference( data_refSouthPole, southPoleCMap );
axisScale.setSide(axisScale.SECONDARY);
}
And I the only thing that is working from the AxisScale is the setTitle,
anything else does not work. Could you tell me what I'm doing wrong?
Thank you very much.
On Tue, 2003-02-11 at 16:09, Bill Hibbard wrote:
> Hi Carlos,
>
> > Hello, I have a chart with many Y axes. So I want to move some axes to
> > the right instead of painting them in the left.
> >
> > Is it possible?
>
> You can do this with the AxisScale.setSide() method.
> See visad/examples/ScaleTest.java for an example.
>
> Cheers,
> Bill
--
Carlos del Castillo Peralta.
QoS Labs México.
ccastillo@xxxxxxxxxxx
Tel: +52 (55) 53402400 ext 2508