static void axisChartTest( String name, AxisChartTestBase axisChartTestBase ) throws ChartDataException, PropertyException
{
LegendProperties legendProperties;
ChartProperties chartProperties;
AxisProperties axisProperties;
AxisChart axisChart;
int numTestsToRun = 10;
String fileName;
HTMLGenerator htmlGenerator = new HTMLGenerator( ChartTestDriver.OUTPUT_PATH + name + "Test.html" );
for( int i = 0; i < numTestsToRun; i++ )
{
DataSeries dataSeries= axisChartTestBase.getDataSeries();
boolean horizontalPlot= true; //( TestDataGenerator.getRandomNumber( 1 ) > 0.5d );
boolean createImageMap= true; //( TestDataGenerator.getRandomNumber( 1 ) > 0.5d );
axisProperties = new AxisProperties( horizontalPlot );
axisProperties.setXAxisLabelsAreVertical( ( TestDataGenerator.getRandomNumber( 1 ) > 0.5d ) );
TestDataGenerator.randomizeAxisProperties( axisProperties );
//axisProperties.setYAxisNumItems( 6 );
DataAxisProperties dataAxisProperties;
LabelAxisProperties labelAxisProperties;
if( horizontalPlot )
{
dataAxisProperties = ( DataAxisProperties ) axisProperties.getXAxisProperties();
labelAxisProperties = ( LabelAxisProperties ) axisProperties.getYAxisProperties();
}
else
{
dataAxisProperties = ( DataAxisProperties ) axisProperties.getYAxisProperties();
labelAxisProperties = ( LabelAxisProperties ) axisProperties.getXAxisProperties();
}
dataAxisProperties.setRoundToNearest( 1 );
//dataAxisProperties.setUserDefinedScale( 10, 500 );
//---if the labels are NULL, force to zero.
if( dataSeries.getNumberOfAxisLabels() == 0 )
{
labelAxisProperties.setShowAxisLabels( false );
}
else
{
labelAxisProperties.setShowAxisLabels( ( TestDataGenerator.getRandomNumber( 1 ) > 0.3d ) );
}
int width = ( int ) TestDataGenerator.getRandomNumber( 500, 1000 );
int height = ( int ) TestDataGenerator.getRandomNumber( 300, 800 );
legendProperties = new LegendProperties();
TestDataGenerator.randomizeLegend( legendProperties );
//legendProperties.setPlacement( LegendAreaProperties.RIGHT );
chartProperties = new ChartProperties();
//chartProperties.setBorderStroke( new BasicStroke( 1f ) );
axisChart = new AxisChart( dataSeries, chartProperties, axisProperties, legendProperties, width, height );
fileName = ChartTestDriver.OUTPUT_PATH + name + i + ChartTestDriver.EXTENSION;
ImageMap imageMap;
if( createImageMap && axisChartTestBase.supportsImageMap() )
{
axisChart.renderWithImageMap();
imageMap= axisChart.getImageMap();
}
else
{
imageMap= null;
}
try
{
ChartTestDriver.exportImage( axisChart, fileName );
}
catch( NullPointerException nullPointerException )
{
nullPointerException.printStackTrace();
System.out.println();
}
axisChart.toHTML( htmlGenerator, fileName, imageMap );
htmlGenerator.addLineBreak();
}
htmlGenerator.saveFile();
}