JIDE 3.5.15

com.jidesoft.chart
Class RectangularRegionMarker

java.lang.Object
  extended by com.jidesoft.chart.RectangularRegionMarker
All Implemented Interfaces:
Drawable, Frontable, ZOrder

public class RectangularRegionMarker
extends Object
implements Drawable, Frontable, ZOrder

A Drawable object that can be added to a Chart to mark a rectangular region. If you set the chart property, then the chart will automatically be repainted when the color or intervals of the region change.

Note that the label for a RectangularRegionMarker will always scroll when the chart is embedded in a JViewport whereas the label for a LineMarker or IntervalMarker will not scroll, but stay fixed in position relative to the marker.


Field Summary
static String PROPERTY_AT_FRONT
          The name used in a Property Change Event when the atFront property changes
static String PROPERTY_CHART
          The name used in a Property Change Event when the Chart property changes
static String PROPERTY_COLOR
          The name used in a Property Change Event when the Color property changes
static String PROPERTY_LABEL
          The name used in a Property Change Event when the Label property changes
static String PROPERTY_LABEL_COLOR
          The name used in a Property Change Event when the LabelColor property changes
static String PROPERTY_LABEL_FONT
          The name used in a Property Change Event when the LabelFont property changes
static String PROPERTY_LABEL_PLACEMENT
          The name used in a Property Change Event when the LabelPlacement property changes
static String PROPERTY_OUTLINE_COLOR
          The name of the property used for the outline color
static String PROPERTY_OUTLINE_STROKE
          The name of the property used for the outline
static String PROPERTY_PAINT
          The name used in a Property Change Event when the Paint property changes
static String PROPERTY_VISIBLE
          The name used in a Property Change Event when the Visible property changes.
static String PROPERTY_X_INTERVAL
          The name used in a Property Change Event when the XInterval property changes
static String PROPERTY_Y_INTERVAL
          The name used in a Property Change Event when the YInterval property changes
protected  PropertyChangeSupport support
           
 
Constructor Summary
RectangularRegionMarker()
          Zero argument constructor.
RectangularRegionMarker(Chart chart)
          Create a marker and set the Chart object to which this marker applies
RectangularRegionMarker(Chart chart, double xMin, double xMax, double yMin, double yMax, Paint paint)
          Create a rectangular marker and set all properties
 
Method Summary
 void addPropertyChangeListener(PropertyChangeListener listener)
          Adds an object that is interested in property changes in this object
 void draw(Graphics g)
          The callback method to draw the object.
 Chart getChart()
          Returns the chart with which this marker is associated
 Color getColor()
          Returns the color of the marker object.
 String getLabel()
          Returns the label used on this marker, if any.
 Color getLabelColor()
          Returns the current color setting for the label
 Font getLabelFont()
          Returns the font of the label
 LabelPlacement getLabelPlacement()
          Returns the current position of the label
 Color getOutlineColor()
          Returns the outline color for the rectangular region, or null if not used
 Stroke getOutlineStroke()
          The stroke currently used for painting the outline of the rectangle
 Paint getPaint()
          Returns the paint used for the marker object
 NumericRange getXInterval()
          Returns the x interval of the marker
 NumericRange getYInterval()
          Returns the y interval of the marker
 int getZOrder()
           
 boolean isAtFront()
          A method of the Frontable interface.
 boolean isVisible()
          Returns whether this marker object is currently visible
 void removePropertyChangeListener(PropertyChangeListener listener)
          Remove a previously added listener
 void setAtFront(boolean atFront)
          Specify whether the marker should be drawn in front of the chart models
 void setChart(Chart chart)
          Set the chart that this object will update if any of the properties change
 void setColor(Color color)
          Specify the color of the marker object
 void setLabel(String label)
          Specify a text label for the marker.
 void setLabelColor(Color labelColor)
          Specify the color to use for the label.
 void setLabelFont(Font labelFont)
          Specify the font used for displaying the label [optional]
 void setLabelPlacement(LabelPlacement labelPlacement)
          Specify where to place the label, if one has been provided
 void setOutlineColor(Color outlineColor)
          Specify the outline color for the rectangular region, or null if not used
 void setOutlineStroke(Stroke outlineStroke)
          Specify the stroke to use for the outline of the rectangular region.
 void setPaint(Paint paint)
          Specify the paint to use for the marker object.
 void setRenderingHint(RenderingHints.Key hint, Object value)
           
 void setVisible(boolean visible)
          Specify whether this marker object should be drawn.
 void setXInterval(double min, double max)
          Specifies the upper and lower bounds of the rectangular region on the x axis
 void setYInterval(double min, double max)
          Specifies the upper and lower bounds of the rectangular region on the y axis
 void setZOrder(int zOrder)
           
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Field Detail

PROPERTY_AT_FRONT

public static final String PROPERTY_AT_FRONT
The name used in a Property Change Event when the atFront property changes

See Also:
Constant Field Values

PROPERTY_VISIBLE

public static final String PROPERTY_VISIBLE
The name used in a Property Change Event when the Visible property changes.

See Also:
Constant Field Values

PROPERTY_COLOR

public static final String PROPERTY_COLOR
The name used in a Property Change Event when the Color property changes

See Also:
Constant Field Values

PROPERTY_PAINT

public static final String PROPERTY_PAINT
The name used in a Property Change Event when the Paint property changes

See Also:
Constant Field Values

PROPERTY_CHART

public static final String PROPERTY_CHART
The name used in a Property Change Event when the Chart property changes

See Also:
Constant Field Values

PROPERTY_X_INTERVAL

public static final String PROPERTY_X_INTERVAL
The name used in a Property Change Event when the XInterval property changes

See Also:
Constant Field Values

PROPERTY_Y_INTERVAL

public static final String PROPERTY_Y_INTERVAL
The name used in a Property Change Event when the YInterval property changes

See Also:
Constant Field Values

PROPERTY_LABEL

public static final String PROPERTY_LABEL
The name used in a Property Change Event when the Label property changes

See Also:
Constant Field Values

PROPERTY_LABEL_PLACEMENT

public static final String PROPERTY_LABEL_PLACEMENT
The name used in a Property Change Event when the LabelPlacement property changes

See Also:
Constant Field Values

PROPERTY_LABEL_COLOR

public static final String PROPERTY_LABEL_COLOR
The name used in a Property Change Event when the LabelColor property changes

See Also:
Constant Field Values

PROPERTY_LABEL_FONT

public static final String PROPERTY_LABEL_FONT
The name used in a Property Change Event when the LabelFont property changes

See Also:
Constant Field Values

PROPERTY_OUTLINE_COLOR

public static final String PROPERTY_OUTLINE_COLOR
The name of the property used for the outline color

See Also:
Constant Field Values

PROPERTY_OUTLINE_STROKE

public static final String PROPERTY_OUTLINE_STROKE
The name of the property used for the outline

See Also:
Constant Field Values

support

protected final PropertyChangeSupport support
Constructor Detail

RectangularRegionMarker

public RectangularRegionMarker()
Zero argument constructor. Usually you would use one of the other constructors to automatically set some of the properties at object creation time.


RectangularRegionMarker

public RectangularRegionMarker(Chart chart)
Create a marker and set the Chart object to which this marker applies

Parameters:
chart - the chart object to which this marker applies.

RectangularRegionMarker

public RectangularRegionMarker(Chart chart,
                               double xMin,
                               double xMax,
                               double yMin,
                               double yMax,
                               Paint paint)
Create a rectangular marker and set all properties

Parameters:
chart - the chart to which this marker applies
xMin - the minimum x value for the region
xMax - the maximum x value for the region
yMin - the minimum y value for the region
yMax - the maximum y value for the region
paint - the color or other paint for the region
Method Detail

addPropertyChangeListener

public void addPropertyChangeListener(PropertyChangeListener listener)
Adds an object that is interested in property changes in this object

Parameters:
listener - the interested object

removePropertyChangeListener

public void removePropertyChangeListener(PropertyChangeListener listener)
Remove a previously added listener

Parameters:
listener - the listener to remove

getChart

public Chart getChart()
Returns the chart with which this marker is associated

Returns:
the chart with which this marker is associated

setChart

public void setChart(Chart chart)
Set the chart that this object will update if any of the properties change

Parameters:
chart - the Chart object

setRenderingHint

public void setRenderingHint(RenderingHints.Key hint,
                             Object value)

isVisible

public boolean isVisible()
Returns whether this marker object is currently visible

Returns:
whether the marker object is currently visible

setVisible

public void setVisible(boolean visible)
Specify whether this marker object should be drawn. Sometimes it may be useful to keep it associated with the chart but to temporarily remove it visually from the chart.

Parameters:
visible - whether the marker should be drawn

getColor

public Color getColor()
Returns the color of the marker object. If a paint is used that is not a color, this returns null.

Returns:
the color of the marker object.

setColor

public void setColor(Color color)
Specify the color of the marker object

Parameters:
color - the new color

getPaint

public Paint getPaint()
Returns the paint used for the marker object

Returns:
the paint used for the marker object

setPaint

public void setPaint(Paint paint)
Specify the paint to use for the marker object. If the paint happens to be a Color, you could call either this method or setColor - the end result is the same.

Parameters:
paint - the new paint.

getXInterval

public NumericRange getXInterval()
Returns the x interval of the marker

Returns:
the x interval of the marker

getYInterval

public NumericRange getYInterval()
Returns the y interval of the marker

Returns:
the y interval of the marker

setXInterval

public void setXInterval(double min,
                         double max)
Specifies the upper and lower bounds of the rectangular region on the x axis

Parameters:
min - the minimum x value
max - the maximum x value

setYInterval

public void setYInterval(double min,
                         double max)
Specifies the upper and lower bounds of the rectangular region on the y axis

Parameters:
min - the minimum y value
max - the maximum y value

getLabel

public String getLabel()
Returns the label used on this marker, if any.

Returns:
the textual label, if any.

setLabel

public void setLabel(String label)
Specify a text label for the marker. This will usually be used to indicate to the user the purpose of the marker.


getLabelPlacement

public LabelPlacement getLabelPlacement()
Returns the current position of the label

Returns:
the current positioning of the label

setLabelPlacement

public void setLabelPlacement(LabelPlacement labelPlacement)
Specify where to place the label, if one has been provided

Parameters:
labelPlacement - where to place the label

getLabelColor

public Color getLabelColor()
Returns the current color setting for the label

Returns:
the color used for the label

setLabelColor

public void setLabelColor(Color labelColor)
Specify the color to use for the label. If the color is not specified, the same color will be used as for the line.

Parameters:
labelColor - the color to use for the label

getLabelFont

public Font getLabelFont()
Returns the font of the label

Returns:
the font used for displaying the label

setLabelFont

public void setLabelFont(Font labelFont)
Specify the font used for displaying the label [optional]

Parameters:
labelFont - the font for the label

getOutlineColor

public Color getOutlineColor()
Returns the outline color for the rectangular region, or null if not used

Returns:
the outline color for the rectangular region

getZOrder

public int getZOrder()
Specified by:
getZOrder in interface ZOrder

setZOrder

public void setZOrder(int zOrder)
Specified by:
setZOrder in interface ZOrder

setOutlineColor

public void setOutlineColor(Color outlineColor)
Specify the outline color for the rectangular region, or null if not used

Parameters:
outlineColor - the new outline color

getOutlineStroke

public Stroke getOutlineStroke()
The stroke currently used for painting the outline of the rectangle

Returns:
the outline stroke for the rectangular region

setOutlineStroke

public void setOutlineStroke(Stroke outlineStroke)
Specify the stroke to use for the outline of the rectangular region. This is a solid line of width 1 by default.

Parameters:
outlineStroke - the outline stroke

draw

public void draw(Graphics g)
The callback method to draw the object. It cannot be drawn if the chart property is not set or if either the xInterval or yInterval is null.

Specified by:
draw in interface Drawable
Parameters:
g - the Graphics context

isAtFront

public boolean isAtFront()
A method of the Frontable interface. By default returns false so the filling is drawn behind any lines.

Specified by:
isAtFront in interface Frontable
Returns:
whether the marker should be drawn in front of the Chart Models

setAtFront

public void setAtFront(boolean atFront)
Specify whether the marker should be drawn in front of the chart models

Specified by:
setAtFront in interface Frontable
Parameters:
atFront - whether the object is to be shown in front of ChartModels.

JIDE 3.5.15