com.approximatrix.charting.render
Class MultiScatterChartRenderer

java.lang.Object
  extended by com.approximatrix.charting.render.AbstractChartRenderer
      extended by com.approximatrix.charting.render.MultiScatterChartRenderer
All Implemented Interfaces:
Renderer

public class MultiScatterChartRenderer
extends AbstractChartRenderer

This renderer creates a scatter chart based on data contained in a MultiScatterDataModel. The renderer will draw line and/or markers, depending on the settings contained within each data set on the MultiScatterDataModel. This renderer also provides buffering of transformed coordinates, which in turn causes the refresh speed to be increased significantly.

Version:
1.0
Author:
armstrong

Field Summary
protected  java.awt.Rectangle bounds
           
private  boolean buffer_transform
          Flag indicating whether coordinate transform buffering should be used
protected  CoordSystem coord
           
private  java.awt.geom.AffineTransform last
          Buffered version of the coordinate transform used for painting
protected  MultiScatterDataModel model
           
protected  RowColorModel rcm
           
protected  double shapeSize
           
private  java.util.ArrayList transformed
          ArrayList of transformed Point2D arrays for buffering the coordinate transform
 
Fields inherited from class com.approximatrix.charting.render.AbstractChartRenderer
listener, stopFlag
 
Constructor Summary
MultiScatterChartRenderer(CoordSystem cs, MultiScatterDataModel model)
          Creates new LineChartRenderer
 
Method Summary
private  void drawline(java.awt.geom.AffineTransform yaxis1, int set, java.awt.Graphics2D g)
          Performs the line drawing for a given data set if called
private  void drawmarkers(java.awt.geom.AffineTransform yaxis1, int set, java.awt.Graphics2D g)
          Performs the drawing point markers for a given data set if called
 void fireDataUpdate()
          Clears all buffered transformation and drawing information
 java.awt.Rectangle getBounds()
          Returns the graphical bounds for this renderer
 ChartDataModel getChartDataModel()
          Returns the ChartDataModel whose DataSets are rendered.
 CoordSystem getCoordSystem()
          Returns the current ClassicCoordSystem.
 java.awt.Dimension getPreferredSize()
          Returns the renderer's prefered size
 RowColorModel getRowColorModel()
          Returns the RowColorModel currently in use.
 java.awt.geom.AffineTransform getTransform(int axis)
          Returns the currently defined AffineTransform for any y-axis.
 void render(java.awt.Graphics2D g)
          Renders the plot to the specifed graphics object.
 void renderChart(java.awt.Graphics2D g)
          Finally renders the Object in the Graphics object.
 void setAllowBuffer(boolean value)
          Sets whether the renderer can buffer data internally for faster drawing
 void setBounds(java.awt.Rectangle bounds)
          Sets the graphical bounds for this renderer
 void setChartDataModel(ChartDataModel model)
          Sets the ChartDataModel whose DataSets are rendered.
 void setCoordSystem(CoordSystem cs)
          Sets the ClassicCoordSystem which contains the AffineTransforms to translate into pixel space.
 void setRowColorModel(RowColorModel rcm)
          Sets a RowColorModel to define the correlation of row titles and colors used for the Legend.
 
Methods inherited from class com.approximatrix.charting.render.AbstractChartRenderer
addRenderChangeListener, clearRenderChangeListeners, fireRenderChangeEvent, interruptRendering, removeRenderChangeListener, resetStopFlag
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Field Detail

bounds

protected java.awt.Rectangle bounds

coord

protected CoordSystem coord

model

protected MultiScatterDataModel model

rcm

protected RowColorModel rcm

shapeSize

protected double shapeSize

last

private java.awt.geom.AffineTransform last
Buffered version of the coordinate transform used for painting


transformed

private java.util.ArrayList transformed
ArrayList of transformed Point2D arrays for buffering the coordinate transform


buffer_transform

private boolean buffer_transform
Flag indicating whether coordinate transform buffering should be used

Constructor Detail

MultiScatterChartRenderer

public MultiScatterChartRenderer(CoordSystem cs,
                                 MultiScatterDataModel model)
Creates new LineChartRenderer

Parameters:
rcm - the RowColorModel needed to determine the right colors
cs - the ClassicCoordSystem used to translate values into points
model - the DataModel that should be rendered
Method Detail

renderChart

public void renderChart(java.awt.Graphics2D g)
Finally renders the Object in the Graphics object.

Specified by:
renderChart in class AbstractChartRenderer
Parameters:
g - the Graphics2D object in which to render

drawline

private void drawline(java.awt.geom.AffineTransform yaxis1,
                      int set,
                      java.awt.Graphics2D g)
Performs the line drawing for a given data set if called

Parameters:
yaxis1 - the transform to be used
set - the dataset to draw
g - the graphics to be painted to

drawmarkers

private void drawmarkers(java.awt.geom.AffineTransform yaxis1,
                         int set,
                         java.awt.Graphics2D g)
Performs the drawing point markers for a given data set if called

Parameters:
yaxis1 - the transform to be used
set - the dataset to draw
g - the graphics to be painted to

getPreferredSize

public java.awt.Dimension getPreferredSize()
Returns the renderer's prefered size

Specified by:
getPreferredSize in interface Renderer
Overrides:
getPreferredSize in class AbstractChartRenderer
Returns:
a non-null Dimension object

setBounds

public void setBounds(java.awt.Rectangle bounds)
Sets the graphical bounds for this renderer

Specified by:
setBounds in interface Renderer
Overrides:
setBounds in class AbstractChartRenderer
Parameters:
bounds - the new bounds for the renderer.

getBounds

public java.awt.Rectangle getBounds()
Returns the graphical bounds for this renderer

Specified by:
getBounds in interface Renderer
Overrides:
getBounds in class AbstractChartRenderer
Returns:
the bounds of this renderer. If setBounds has not been called before, the bounds computed from getPreferredSize is returned.

render

public void render(java.awt.Graphics2D g)
Renders the plot to the specifed graphics object. Most work is done in the renderChart() routine.

Specified by:
render in interface Renderer
Overrides:
render in class AbstractChartRenderer
Parameters:
g - the Graphics2D object in which to render

setChartDataModel

public void setChartDataModel(ChartDataModel model)
Sets the ChartDataModel whose DataSets are rendered.

Overrides:
setChartDataModel in class AbstractChartRenderer
Parameters:
model - the ChartDataModel

getChartDataModel

public ChartDataModel getChartDataModel()
Returns the ChartDataModel whose DataSets are rendered.

Overrides:
getChartDataModel in class AbstractChartRenderer
Returns:
a ChartDataModel which contains the Chart's data

getCoordSystem

public CoordSystem getCoordSystem()
Returns the current ClassicCoordSystem.

Overrides:
getCoordSystem in class AbstractChartRenderer

setCoordSystem

public void setCoordSystem(CoordSystem cs)
Sets the ClassicCoordSystem which contains the AffineTransforms to translate into pixel space.

Overrides:
setCoordSystem in class AbstractChartRenderer
Parameters:
cs - the new ClassicCoordSystem

getTransform

public java.awt.geom.AffineTransform getTransform(int axis)
Returns the currently defined AffineTransform for any y-axis.

Overrides:
getTransform in class AbstractChartRenderer
Parameters:
axis - the y-axis to be used.

setRowColorModel

public void setRowColorModel(RowColorModel rcm)
Sets a RowColorModel to define the correlation of row titles and colors used for the Legend.

Overrides:
setRowColorModel in class AbstractChartRenderer
Parameters:
rcm - the RowColorModel

getRowColorModel

public RowColorModel getRowColorModel()
Returns the RowColorModel currently in use.

Overrides:
getRowColorModel in class AbstractChartRenderer
Returns:
a RowColorModel

fireDataUpdate

public void fireDataUpdate()
Clears all buffered transformation and drawing information


setAllowBuffer

public void setAllowBuffer(boolean value)
Sets whether the renderer can buffer data internally for faster drawing

Parameters:
value - true to allow drawing, false otherwise