Author |
Topic  |
|
Peter
17 Posts |
Posted - 18 Jun 2009 : 12:27:48
|
I'm a noob with this plotting package so I could be missing something really obvious here...
I have 10 SimpleDatasets I'm plotting using SimpleBarPlots. I can't seem to get more than 5 (out of the 10 defined) z-axis labels to appear--the 5 that show up ("A" though "E" in the example below) are evenly spaced across the entire z-axis. The grid for the XZ_MINY_PLANE also only has 5 major tick lines for the z-axis (which coorespond to the 5 labels that are showing up).
Code relevant to z-axis configuration (mutated from some of the examples):
// Define the z-axis LinearAxis zAxis = new LinearAxis( pTransform1, ChartConstants.Z_AXIS, 0, 1 ); zAxis.setColor( ChartColors.BLACK ); zAxis.setAxisIntercept( xAxis.getAxisMax() ); zAxis.setAxisIntercept2( 0.0 ); gWG.addChartObject( zAxis );
// Define the z-axis string labels String[] zlabels = { "A", "B", "C", "D", "E", "F", "G", "H", "I", "J" }; StringAxisLabels zAxisLab = new StringAxisLabels( zAxis ); zAxisLab.setColor( ChartColors.BLACK ); zAxisLab.setAxisLabels( theFont, 0, ChartConstants.AXIS_MIN, ChartConstants.LABEL_ALL, ChartColors.BLACK, zlabels, zlabels.length ); zAxisLab.setOverlapLabelMode( ChartConstants.OVERLAP_LABEL_DRAW ); gWG.addChartObject( zAxisLab );
// Define the z-axis grid for the XZ_MINY_PLANE Grid zgrid2 = new Grid( xAxis, zAxis, ChartConstants.Z_AXIS, ChartConstants.GRID_MAJOR ); zgrid2.setColor( ChartColors.WHITE ); zgrid2.setLineStyle( ChartConstants.LS_SOLID ); zgrid2.setLineWidth( 1 ); zgrid2.setGridAxisPlane( ChartConstants.XZ_MINY_PLANE ); gWG.addChartObject( zgrid2 );
// Define the z-axis grid for the XZ_MINY_PLANE Grid bottomxgrid = new Grid( xAxis, zAxis, ChartConstants.X_AXIS, ChartConstants.GRID_MAJOR ); bottomxgrid.setColor( ChartColors.WHITE ); bottomxgrid.setLineStyle( ChartConstants.LS_SOLID ); bottomxgrid.setLineWidth( 1 ); bottomxgrid.setGridAxisPlane( ChartConstants.XZ_MINY_PLANE ); gWG.addChartObject( bottomxgrid );
|
|
quinncurtis
1164 Posts |
Posted - 18 Jun 2009 : 12:42:46
|
Unless otherwise specified, the software will choose default values for the number and spacing of tick marks. If you use custom string axis label, you need to override those values in order to place the strings correctly.
Assuming your z-axis range is (0-10), then you want a minor tick mark spacing of 1.0, and a major tick mark at every minor tick interval.
LinearAxis zAxis = new LinearAxis( pTransform1, ChartConstants.Z_AXIS, 0, 1 ); zAxis.setColor( ChartColors.BLACK ); zAxis.setAxisIntercept( xAxis.getAxisMax() ); zAxis.setAxisIntercept2( 0.0 );
zAxis.setAxisTickSpace(1); zAxis.setAxisMinorTicksPerMajor( 1);
gWG.addChartObject( zAxis );
|
 |
|
Peter
17 Posts |
Posted - 18 Jun 2009 : 13:01:17
|
I put in your code snippet, rescaled my z-axis from 0-1 to 0-10 and set the max-z argument for the Cartesian Coordinates constructor, it worked. 
Thanks!
|
 |
|
quinncurtis
1164 Posts |
Posted - 18 Jun 2009 : 13:14:04
|
There was no need to rescale your z-axis, if you had it scaled for (0-1 in your example) some particular reason. Just choose a tick mark spacing that places at least 10 tick marks on the z-axis. Then specify that every tick mark should be a major tick mark. For a (0-1) range:
zAxis.setAxisTickSpace(0.1); zAxis.setAxisMinorTicksPerMajor(1); |
 |
|
Peter
17 Posts |
Posted - 18 Jun 2009 : 13:49:50
|
Hmmmm after rescaling the z-axis from 0-1 to 0-10 as in my post above, the grids on the XY_MAXZ_PLANE are still being drawn at z=1.0. The back wall is being drawn in the correct spot so I assume the XY_MAXZ_PLANE is set correctly.
// transform CartesianCoordinates pTransform1 = new CartesianCoordinates( 1930., 0., 0., 2040., 5000., 10. );
// Define the walls ChartAttribute wallAttrib = new ChartAttribute( ChartColors.BEIGE, 1, ChartConstants.LS_SOLID, ChartColors.LIGHTBLUE ); Wall3D xyMaxZWall = new Wall3D( pTransform1, ChartConstants.XY_MAXZ_PLANE, 0.02, wallAttrib ); gWG.addChartObject( xyMaxZWall );
// Define the x-axis grid for the XY_MAXZ_PLANE Grid xgrid = new Grid( xAxis, yAxis, ChartConstants.X_AXIS, ChartConstants.GRID_MAJOR ); xgrid.setColor( ChartColors.WHITE ); xgrid.setLineWidth( 1 ); xgrid.setLineStyle( ChartConstants.LS_SOLID ); xgrid.setGridAxisPlane( ChartConstants.XY_MAXZ_PLANE ); xgrid.setChartObjScale( pTransform1 ); gWG.addChartObject( xgrid );
// Define the y-axis grid for the XY_MAXZ_PLANE Grid ygrid = new Grid( xAxis, yAxis, ChartConstants.Y_AXIS, ChartConstants.GRID_MAJOR ); ygrid.setColor( ChartColors.WHITE ); ygrid.setLineStyle( ChartConstants.LS_SOLID ); ygrid.setLineWidth( 1 ); ygrid.setGridAxisPlane( ChartConstants.XY_MAXZ_PLANE ); ygrid.setChartObjScale( pTransform1 ); gWG.addChartObject( ygrid );
|
 |
|
quinncurtis
1164 Posts |
Posted - 18 Jun 2009 : 14:01:27
|
As we said in the previous post, if you had it setup correctly for a z-scale of 0-1, you should leave it at that, just correctly specify the tick mark spacing and setAxisMinorTicksPerMajor.
In order to troubleshoot your 0-10 z-axis scale, we would probably need to see the complete program, because one of your other values somewhere does not take into account the 0-10 range. |
 |
|
Peter
17 Posts |
Posted - 18 Jun 2009 : 14:18:17
|
No problem. I couldn't find anything obvious where the scaling in the z-axis was wrong.
No matter, under the current time pressure for this project, I simply rescaled z back to 0-1 and everything is behaving.
The plot/animation looks great! Thanks for your very timely assistance.
|
 |
|
|
Topic  |
|
|
|