edu.ucla.stat.SOCR.motionchart
Class MotionBubbleRenderer

java.lang.Object
  extended by XYBubbleRenderer
      extended by edu.ucla.stat.SOCR.motionchart.MotionBubbleRenderer

public class MotionBubbleRenderer
extends XYBubbleRenderer

Package: edu.ucla.stat.SOCR.motionchart Date: Dec 2, 2008 Time: 12:36:52 PM

Author:
Jameel

Constructor Summary
MotionBubbleRenderer(MotionDataSet dataset)
          Creates a new MotionBubbleRenderer instance.
MotionBubbleRenderer(MotionDataSet dataset, int scaleType)
          Constructs a new MotionBubbleRenderer with the specified type of scaling.
 
Method Summary
 void axisChanged(AxisChangeEvent event)
          Receives notification of an axis change event.
protected  java.awt.geom.Point2D calculateLabelAnchorPoint(ItemLabelAnchor anchor, double x, double y, PlotOrientation orientation)
          Calculates the item label anchor point.
 void datasetChanged(DatasetChangeEvent event)
          Receives notification of an dataset change event.
 void drawItem(java.awt.Graphics2D g2, XYItemRendererState state, java.awt.geom.Rectangle2D dataArea, PlotRenderingInfo info, XYPlot plot, ValueAxis domainAxis, ValueAxis rangeAxis, XYDataset dataset, int series, int item, CrosshairState crosshairState, int pass)
          Draws the visual representation of a single data item.
 java.awt.Paint getItemLabelPaint(int row, int column)
          Returns the paint used to draw an item label.
 java.awt.Paint getItemOutlinePaint(int row, int column)
          Returns the paint used to outline data items as they are drawn.
 java.awt.Stroke getItemOutlineStroke(int row, int column)
          Returns the stroke used to outline data items.
 java.awt.Paint getItemPaint(int row, int column)
          Returns the paint used to fill data items as they are drawn.
 java.awt.Shape getItemShape(int row, int column)
          Returns a shape used to represent a data item.
 java.lang.Boolean getSeriesVisible(int series)
          Returns the flag that controls whether a series is visible.
 java.util.ArrayList<java.lang.Integer> getVisibleSeries()
          Returns indices of all visible series.
 boolean isHighlightedItem(int series, int item)
          Determines whether or not the item in the series is highlighted.
 boolean isItemLabelVisible(int row, int column)
          Returns true if an item label is visible, and false otherwise.
 boolean isSelectedCategory(java.lang.Object category)
          Determines whether or not the category is selected.
 boolean isSelectedItem(int series, int item)
          Determines whether or not the item in the series is selected.
 void plotChanged(PlotChangeEvent event)
          Receives notification of a plot change event.
 void setHighlightedItem(int series, int item)
          Sets the item to be highlighted (use (-1, -1) for no highlight).
 void setPlot(XYPlot plot)
          Sets the plot that the renderer is assigned to.
 void setSelectedCategory(java.lang.Object category)
          Sets the category to be selected.
 void setSelectedCategory(java.lang.Object category, boolean selected)
          Sets the category to be selected.
 void setSelectedItem(int series, int item)
          Sets the item to be selected.
 void setSelectedItem(int series, int item, boolean selected)
          Sets the item to be selected.
protected  java.awt.geom.Ellipse2D.Double translateShape(java.awt.geom.Ellipse2D.Double shape, XYPlot plot, java.awt.geom.Rectangle2D dataArea)
          Translates the shape so that it displays correctly given the plot and dataArea.
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Constructor Detail

MotionBubbleRenderer

public MotionBubbleRenderer(MotionDataSet dataset)
Creates a new MotionBubbleRenderer instance.

Parameters:
dataset - the dataset to be rendered (an MotionDataSet is expected).

MotionBubbleRenderer

public MotionBubbleRenderer(MotionDataSet dataset,
                            int scaleType)
Constructs a new MotionBubbleRenderer with the specified type of scaling.

Parameters:
dataset - the dataset that the renderer will use
scaleType - the type of scaling (must be one of: #SCALE_ON_BOTH_AXES, #SCALE_ON_DOMAIN_AXIS, #SCALE_ON_RANGE_AXIS).
Method Detail

drawItem

public void drawItem(java.awt.Graphics2D g2,
                     XYItemRendererState state,
                     java.awt.geom.Rectangle2D dataArea,
                     PlotRenderingInfo info,
                     XYPlot plot,
                     ValueAxis domainAxis,
                     ValueAxis rangeAxis,
                     XYDataset dataset,
                     int series,
                     int item,
                     CrosshairState crosshairState,
                     int pass)
Draws the visual representation of a single data item.

Parameters:
g2 - the graphics device.
state - the renderer state.
dataArea - the area within which the data is being drawn.
info - collects information about the drawing.
plot - the plot (can be used to obtain standard color information etc).
domainAxis - the domain (horizontal) axis.
rangeAxis - the range (vertical) axis.
dataset - the dataset (a MotionDataSet is expected).
series - the series index (zero-based).
item - the item index (zero-based).
crosshairState - crosshair information for the plot (null permitted).
pass - the pass index.

translateShape

protected java.awt.geom.Ellipse2D.Double translateShape(java.awt.geom.Ellipse2D.Double shape,
                                                        XYPlot plot,
                                                        java.awt.geom.Rectangle2D dataArea)
Translates the shape so that it displays correctly given the plot and dataArea.

Parameters:
shape - the shape to translate
plot - the plot that will be used to translate the shape
dataArea - the dataArea that the shape will be translated to
Returns:
The translated shape

calculateLabelAnchorPoint

protected java.awt.geom.Point2D calculateLabelAnchorPoint(ItemLabelAnchor anchor,
                                                          double x,
                                                          double y,
                                                          PlotOrientation orientation)
Calculates the item label anchor point.

Parameters:
anchor - the anchor.
x - the x coordinate.
y - the y coordinate.
orientation - the plot orientation.
Returns:
The anchor point (never null).

getSeriesVisible

public java.lang.Boolean getSeriesVisible(int series)
Returns the flag that controls whether a series is visible.

Parameters:
series - the series index (zero-based).
Returns:
The flag (possibly null).
See Also:
#setSeriesVisible(int, Boolean)

getVisibleSeries

public java.util.ArrayList<java.lang.Integer> getVisibleSeries()
Returns indices of all visible series.

Returns:
The list of visible series.
See Also:
getSeriesVisible(int)

getItemPaint

public java.awt.Paint getItemPaint(int row,
                                   int column)
Returns the paint used to fill data items as they are drawn.

The default implementation passes control to the lookupSeriesPaint() method. You can override this method if you require different behaviour.

Parameters:
row - the row (or series) index (zero-based).
column - the column (or category) index (zero-based).
Returns:
The paint (never null).

setHighlightedItem

public void setHighlightedItem(int series,
                               int item)
Sets the item to be highlighted (use (-1, -1) for no highlight).

Parameters:
series - the series index (zero-based).
item - the item index (zero-based).

isHighlightedItem

public boolean isHighlightedItem(int series,
                                 int item)
Determines whether or not the item in the series is highlighted.

Parameters:
series - the series index (zero-based).
item - the item index (zero-based).
Returns:
true if the item in the series is highlighted. false otherwise.

setSelectedItem

public void setSelectedItem(int series,
                            int item)
Sets the item to be selected.

Parameters:
series - the series index (zero-based).
item - the item index (zero-based).

setSelectedItem

public void setSelectedItem(int series,
                            int item,
                            boolean selected)
Sets the item to be selected.

Parameters:
series - the series index (zero-based).
item - the item index (zero-based).
selected - true if the item should be selected. false otherwise.

isSelectedItem

public boolean isSelectedItem(int series,
                              int item)
Determines whether or not the item in the series is selected.

Parameters:
series - the series index (zero-based).
item - the item index (zero-based).
Returns:
true if the item in the series is selected. false otherwise.

setSelectedCategory

public void setSelectedCategory(java.lang.Object category)
Sets the category to be selected.

Parameters:
category - the category key.

setSelectedCategory

public void setSelectedCategory(java.lang.Object category,
                                boolean selected)
Sets the category to be selected.

Parameters:
category - the category key.
selected - true if the item should be selected. false otherwise.

isSelectedCategory

public boolean isSelectedCategory(java.lang.Object category)
Determines whether or not the category is selected.

Parameters:
category - the category key.
Returns:
true if the category is selected. false otherwise.

getItemOutlinePaint

public java.awt.Paint getItemOutlinePaint(int row,
                                          int column)
Returns the paint used to outline data items as they are drawn.

The default implementation passes control to the #lookupSeriesOutlinePaint method. You can override this method if you require different behaviour.

Parameters:
row - the row (or series) index (zero-based).
column - the column (or category) index (zero-based).
Returns:
The paint (never null).

getItemOutlineStroke

public java.awt.Stroke getItemOutlineStroke(int row,
                                            int column)
Returns the stroke used to outline data items. The default implementation passes control to the #lookupSeriesOutlineStroke(int) method. You can override this method if you require different behaviour.

Parameters:
row - the row (or series) index (zero-based).
column - the column (or category) index (zero-based).
Returns:
The stroke (never null).

isItemLabelVisible

public boolean isItemLabelVisible(int row,
                                  int column)
Returns true if an item label is visible, and false otherwise.

Parameters:
row - the row index (zero-based).
column - the column index (zero-based).
Returns:
A boolean.

getItemLabelPaint

public java.awt.Paint getItemLabelPaint(int row,
                                        int column)
Returns the paint used to draw an item label.

Parameters:
row - the row index (zero based).
column - the column index (zero based).
Returns:
The paint (never null).

getItemShape

public java.awt.Shape getItemShape(int row,
                                   int column)
Returns a shape used to represent a data item.

The default implementation passes control to the getSeriesShape method. You can override this method if you require different behaviour.

Parameters:
row - the row (or series) index (zero-based).
column - the column (or category) index (zero-based).
Returns:
The shape (never null).

setPlot

public void setPlot(XYPlot plot)
Sets the plot that the renderer is assigned to.

Parameters:
plot - the plot (null permitted).

plotChanged

public void plotChanged(PlotChangeEvent event)
Receives notification of a plot change event.

Parameters:
event - the event.

axisChanged

public void axisChanged(AxisChangeEvent event)
Receives notification of an axis change event.

Parameters:
event - the event.

datasetChanged

public void datasetChanged(DatasetChangeEvent event)
Receives notification of an dataset change event.

Parameters:
event - information about the event.