* @param iAxisChartDataSet
*********************************************************************************************/
static void render( AxisChart axisChart, IAxisChartDataSet iAxisChartDataSet )
{
Graphics2D g2d=axisChart.getGraphics2D();
PointChartProperties pointChartProperties=(PointChartProperties) iAxisChartDataSet.getChartTypeProperties();
//---Point Charts can not be horizontal so we know the y-axis is DataAxisProperties
DataAxisProperties dataAxisProperties= (DataAxisProperties) axisChart.getAxisProperties().getYAxisProperties();
IDataSeries iDataSeries= (IDataSeries) axisChart.getIAxisDataSeries();
float xPosition=axisChart.getXAxis().getTickStart();
float yPosition;
//---when centering the shapes on the points, need x and y offset to do this
double[] cornerXOffset=new double[ iAxisChartDataSet.getNumberOfDataSets() ];
double[] cornerYOffset=new double[ iAxisChartDataSet.getNumberOfDataSets() ];
//---get the original transform so can reset it.
AffineTransform affineTransform=g2d.getTransform();
Rectangle2D rectangle;
//LOOP
//---pre-compute the dimensions of each Shape so do not do it in loop.
for( int i=0; i < iAxisChartDataSet.getNumberOfDataSets(); i++ )
{
rectangle=pointChartProperties.getShape( i ).getBounds2D();
cornerXOffset[ i ]=rectangle.getWidth() / 2;
cornerYOffset[ i ]=rectangle.getHeight() / 2;
}
g2d.setStroke( PointChartProperties.DEFAULT_POINT_BORDER_STROKE );
//LOOP
//---for each item in data set...
for( int i=0; i < iAxisChartDataSet.getNumberOfDataItems(); i++ )
{
//LOOP
//---for each data set
for( int dataSetIndex=0; dataSetIndex < iAxisChartDataSet.getNumberOfDataSets(); dataSetIndex++ )
{
//---if the value is NaN, do not display a value
if( Double.isNaN( iAxisChartDataSet.getValue( dataSetIndex, i ) ) )
{
continue;
}
yPosition= axisChart.getYAxis().computeAxisCoordinate( axisChart.getYAxis().getOrigin(),
iAxisChartDataSet.getValue( dataSetIndex, i ),
axisChart.getYAxis().getScaleCalculator().getMinValue() );
//---if we are generating an ImageMap, store the image coordinates
if( axisChart.getGenerateImageMapFlag() )
{
String label;
if( axisChart.getXAxis().getAxisLabelsGroup() != null )
{
label = axisChart.getXAxis().getAxisLabelsGroup().getTextTag( i ).getText();
}
else
{
label = null;
}
axisChart.getImageMap().addImageMapArea( new CircleMapArea( xPosition,
yPosition,
iAxisChartDataSet.getValue( dataSetIndex, i ),
label,
iAxisChartDataSet.getLegendLabel( dataSetIndex ) ) );
}
//---translate the Shape into position.
g2d.translate( xPosition - cornerXOffset[ dataSetIndex ], yPosition - cornerYOffset[ dataSetIndex ] );
g2d.setPaint( iAxisChartDataSet.getPaint( dataSetIndex ) );
//---render the point
if( pointChartProperties.getFillPointsFlag( dataSetIndex ) )
{
//---fill the point
g2d.fill( pointChartProperties.getShape( dataSetIndex ) );
//---if we are filling the points, see if we should outline the Shape
if( pointChartProperties.getPointOutlinePaints( dataSetIndex ) != null )
{
g2d.setPaint( pointChartProperties.getPointOutlinePaints( dataSetIndex ) );
g2d.draw( pointChartProperties.getShape( dataSetIndex ) );
}
}
else
{
//---if we are NOT filling the points, use the Paint specified with the DataSet to outline.
g2d.draw( pointChartProperties.getShape( dataSetIndex ) );
}
g2d.setTransform( affineTransform );
}