Docjar: A Java Source and Docuemnt Enginecom.*    java.*    javax.*    org.*    all    new    plug-in

Quick Search    Search Deep

com.jrefinery.chart
Class RadarPlot  view RadarPlot download RadarPlot.java

java.lang.Object
  extended byPlot
      extended bycom.jrefinery.chart.RadarPlot

public class RadarPlot
extends Plot

A plot that displays data in the form of a radar chart, using data from any class that implements the CategoryDataSource interface.

Notes: (1) negative values in the dataset are ignored; (2) vertical axis and horizontal axis are set to null; (3) there are utility methods for creating a CategoryDataSource from a CategoryDataset;


Field Summary
static java.awt.Paint ADAPTIVE_COLORING
          A magic color object used to designate adaptive coloring, based on the computed quality index
protected  java.awt.Font axisLabelFont
          The font used to display the axis labels.
protected  double axisLabelGapPercent
          The gap between the labels and the radar axes, as a percentage of the radius.
protected  java.awt.Paint axisLabelPaint
          The color used to draw the axis labels.
protected  boolean circular
          Flag determining whether to draw an ellipse or a perfect circle.
static java.awt.Font DEFAULT_AXIS_LABEL_FONT
          The default axis label font.
static double DEFAULT_AXIS_LABEL_GAP
          The default axis label gap (currently 10%).
static java.awt.Paint DEFAULT_AXIS_LABEL_PAINT
          The default axis label paint.
static double DEFAULT_INTERIOR_GAP
          The default interior gap percent (currently 20%).
static double DEFAULT_RADIUS
          The default radius percent (currently 100%).
protected  boolean drawAxisLabels
          Whether or not axis labels should be drawn
protected  double interiorGapPercent
          The amount of space left around the outside of the radar chart, expressed as a percentage.
static double MAX_AXIS_LABEL_GAP
          The maximum interior gap (currently 30%).
static double MAX_INTERIOR_GAP
          The maximum interior gap (currently 40%).
static double MAX_RADIUS
          The maximum radius (currently 100%).
protected  java.awt.Paint radarSeriesPaint
          The color to use to draw the data polygon
protected  double radiusPercent
          The radius as a percentage of the available drawing area.
 
Constructor Summary
RadarPlot(JFreeChart chart)
          Constructs a new radar chart, using default attributes as required.
RadarPlot(JFreeChart chart, java.awt.Insets insets, java.awt.Paint backgroundPaint, java.awt.Image backgroundImage, float backgroundAlpha, java.awt.Stroke outlineStroke, java.awt.Paint outlinePaint, float foregroundAlpha, double interiorGapPercent, boolean circular, double radiusPercent, java.awt.Font axisLabelFont, java.awt.Paint axisLabelPaint, double axisLabelGapPercent, java.awt.Paint dataPaint)
          Constructs a radar chart.
 
Method Summary
 void draw(java.awt.Graphics2D g2, java.awt.geom.Rectangle2D plotArea)
          Draws the plot on a Java 2D graphics device (such as the screen or a printer).
protected  void drawLabel(java.awt.Graphics2D g2, java.awt.geom.Rectangle2D chartArea, java.lang.String label, int axis, double labelX, double labelY)
          Draws the label for one radar axis.
 java.awt.Font getAxisLabelFont()
          Returns the axis label font.
 double getAxisLabelGapPercent()
          Returns the axis label gap, measures as a percentage of the radius.
 java.awt.Paint getAxisLabelPaint()
          Returns the axis label paint.
 java.util.Collection getCategories()
          Returns a collection of the categories in the dataset.
 CategoryDataSource getDataset()
          Returns the dataset for the plot, cast as a CategoryDataSource.
 CategoryDataSource getDataSource()
           
 double getInteriorGapPercent()
          Returns the interior gap, measures as a percentage of the available drawing space.
private  java.awt.Paint getMultiplierColor(float value)
          Calculate an appropriate color for the quality chart.
 java.awt.Paint getPlotLinePaint()
          Returns the plot line paint.
 java.lang.String getPlotType()
          Returns a short string describing the type of plot.
 double getRadiusPercent()
          Returns the radius percentage.
 boolean isCircular()
          Returns a flag indicating whether the radar chart is circular, or stretched into an elliptical shape.
 boolean isCompatibleHorizontalAxis(Axis axis)
          Returns true if the axis is compatible with the radar chart, and false otherwise.
 boolean isCompatibleVerticalAxis(Axis axis)
          Returns true if the axis is compatible with the radar chart, and false otherwise.
 void setAxisLabelFont(java.awt.Font font)
          Sets the axis label font.
 void setAxisLabelGapPercent(double percent)
          Sets the axis label gap percent.
 void setAxisLabelPaint(java.awt.Paint paint)
          Sets the axis label paint.
 void setCircular(boolean flag)
          A flag indicating whether the radar chart is circular, or stretched into an elliptical shape.
 void setDrawAxisLabels(boolean draw)
           
 void setInteriorGapPercent(double percent)
          Sets the interior gap percent.
 void setPlotLinePaint(java.awt.Paint paint)
          Sets the plot line paint.
 void setRadiusPercent(double percent)
          Sets the radius percentage.
 void zoom(double percent)
          A zoom method that does nothing.
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Field Detail

DEFAULT_INTERIOR_GAP

public static final double DEFAULT_INTERIOR_GAP
The default interior gap percent (currently 20%).

See Also:
Constant Field Values

MAX_INTERIOR_GAP

public static final double MAX_INTERIOR_GAP
The maximum interior gap (currently 40%).

See Also:
Constant Field Values

DEFAULT_RADIUS

public static final double DEFAULT_RADIUS
The default radius percent (currently 100%).

See Also:
Constant Field Values

MAX_RADIUS

public static final double MAX_RADIUS
The maximum radius (currently 100%).

See Also:
Constant Field Values

DEFAULT_AXIS_LABEL_FONT

public static final java.awt.Font DEFAULT_AXIS_LABEL_FONT
The default axis label font.


DEFAULT_AXIS_LABEL_PAINT

public static final java.awt.Paint DEFAULT_AXIS_LABEL_PAINT
The default axis label paint.


DEFAULT_AXIS_LABEL_GAP

public static final double DEFAULT_AXIS_LABEL_GAP
The default axis label gap (currently 10%).

See Also:
Constant Field Values

MAX_AXIS_LABEL_GAP

public static final double MAX_AXIS_LABEL_GAP
The maximum interior gap (currently 30%).

See Also:
Constant Field Values

ADAPTIVE_COLORING

public static final java.awt.Paint ADAPTIVE_COLORING
A magic color object used to designate adaptive coloring, based on the computed quality index


interiorGapPercent

protected double interiorGapPercent
The amount of space left around the outside of the radar chart, expressed as a percentage.


circular

protected boolean circular
Flag determining whether to draw an ellipse or a perfect circle.


radiusPercent

protected double radiusPercent
The radius as a percentage of the available drawing area.


axisLabelFont

protected java.awt.Font axisLabelFont
The font used to display the axis labels.


axisLabelPaint

protected java.awt.Paint axisLabelPaint
The color used to draw the axis labels.


axisLabelGapPercent

protected double axisLabelGapPercent
The gap between the labels and the radar axes, as a percentage of the radius.


radarSeriesPaint

protected java.awt.Paint radarSeriesPaint
The color to use to draw the data polygon


drawAxisLabels

protected boolean drawAxisLabels
Whether or not axis labels should be drawn

Constructor Detail

RadarPlot

public RadarPlot(JFreeChart chart)
          throws AxisNotCompatibleException
Constructs a new radar chart, using default attributes as required.


RadarPlot

public RadarPlot(JFreeChart chart,
                 java.awt.Insets insets,
                 java.awt.Paint backgroundPaint,
                 java.awt.Image backgroundImage,
                 float backgroundAlpha,
                 java.awt.Stroke outlineStroke,
                 java.awt.Paint outlinePaint,
                 float foregroundAlpha,
                 double interiorGapPercent,
                 boolean circular,
                 double radiusPercent,
                 java.awt.Font axisLabelFont,
                 java.awt.Paint axisLabelPaint,
                 double axisLabelGapPercent,
                 java.awt.Paint dataPaint)
          throws AxisNotCompatibleException
Constructs a radar chart.

Method Detail

getInteriorGapPercent

public double getInteriorGapPercent()
Returns the interior gap, measures as a percentage of the available drawing space.


setInteriorGapPercent

public void setInteriorGapPercent(double percent)
Sets the interior gap percent.


isCircular

public boolean isCircular()
Returns a flag indicating whether the radar chart is circular, or stretched into an elliptical shape.


setCircular

public void setCircular(boolean flag)
A flag indicating whether the radar chart is circular, or stretched into an elliptical shape.


getRadiusPercent

public double getRadiusPercent()
Returns the radius percentage.


setRadiusPercent

public void setRadiusPercent(double percent)
Sets the radius percentage.


getAxisLabelFont

public java.awt.Font getAxisLabelFont()
Returns the axis label font.


setAxisLabelFont

public void setAxisLabelFont(java.awt.Font font)
Sets the axis label font.

Notifies registered listeners that the plot has been changed.


getAxisLabelPaint

public java.awt.Paint getAxisLabelPaint()
Returns the axis label paint.


setAxisLabelPaint

public void setAxisLabelPaint(java.awt.Paint paint)
Sets the axis label paint.

Notifies registered listeners that the plot has been changed.


getPlotLinePaint

public java.awt.Paint getPlotLinePaint()
Returns the plot line paint.


setPlotLinePaint

public void setPlotLinePaint(java.awt.Paint paint)
Sets the plot line paint.

Notifies registered listeners that the plot has been changed.


getAxisLabelGapPercent

public double getAxisLabelGapPercent()
Returns the axis label gap, measures as a percentage of the radius.


setAxisLabelGapPercent

public void setAxisLabelGapPercent(double percent)
Sets the axis label gap percent.


setDrawAxisLabels

public void setDrawAxisLabels(boolean draw)

getDataset

public CategoryDataSource getDataset()
Returns the dataset for the plot, cast as a CategoryDataSource.

Provided for convenience.


getDataSource

public CategoryDataSource getDataSource()

getCategories

public java.util.Collection getCategories()
Returns a collection of the categories in the dataset.


draw

public void draw(java.awt.Graphics2D g2,
                 java.awt.geom.Rectangle2D plotArea)
Draws the plot on a Java 2D graphics device (such as the screen or a printer).


getMultiplierColor

private java.awt.Paint getMultiplierColor(float value)
Calculate an appropriate color for the quality chart. if the multiplier is 0, use red; if it is 1, use green; use yellow in between, and fade proportionately.


drawLabel

protected void drawLabel(java.awt.Graphics2D g2,
                         java.awt.geom.Rectangle2D chartArea,
                         java.lang.String label,
                         int axis,
                         double labelX,
                         double labelY)
Draws the label for one radar axis.


getPlotType

public java.lang.String getPlotType()
Returns a short string describing the type of plot.


isCompatibleHorizontalAxis

public boolean isCompatibleHorizontalAxis(Axis axis)
Returns true if the axis is compatible with the radar chart, and false otherwise. Since a radar plot requires no axes, only a null axis is compatible.


isCompatibleVerticalAxis

public boolean isCompatibleVerticalAxis(Axis axis)
Returns true if the axis is compatible with the radar chart, and false otherwise. Since a radar plot requires no axes, only a null axis is compatible.


zoom

public void zoom(double percent)
A zoom method that does nothing.

Plots are required to support the zoom operation. In the case of a radar chart, it doesn't make sense to zoom in or out, so the method is empty.