JIDE 3.5.15

com.jidesoft.chart
Class IntervalMarker

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

public class IntervalMarker
extends Object
implements Drawable, Frontable, Shadowable, ZOrder

A Drawable object that can be added to a Chart to mark an interval on one of the axes. The orientation determines whether the interval applies to the x or y axis. By default, the orientation is vertical.

Note that if an IntervalMarker is used in a Chart that is embedded in a JViewport, the position of the label for the marker does not change under scrolling relative to the marker. In other words, the marker label always stays on screen as long as the marker itself is visible.


Field Summary
static String PROPERTY_AT_FRONT
          The name of the property used to indicate whether the marker is at the front or behind the chart models
static String PROPERTY_CHART
          The name of the property that holds the corresponding chart
static String PROPERTY_COLOR
          The name of the property used for the color of the marker (same as paint if the paint is a java.awt.Color)
static String PROPERTY_LABEL
          The name of the property used for the label of the IntervalMarker
static String PROPERTY_LABEL_COLOR
          The name of the property used for the color of the label
static String PROPERTY_LABEL_FONT
          The name of the property used for the font of the label
static String PROPERTY_LABEL_PLACEMENT
          The name of the property used for the placement of the label
static String PROPERTY_MAX
          The name of the property used for the upper limit of the interval marker
static String PROPERTY_MIN
          The name of the property used for the lower limit of the interval marker
static String PROPERTY_ORIENTATION
          The name of the property that indicates the orientation of the IntervalMarker
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 of the property used for the paint of the marker
static String PROPERTY_SHADOW_VISIBLE
          The name of the property used for the shadow visibility
static String PROPERTY_VISIBLE
          The name of the property to indicate whether the IntervalMarker is visible
protected  PropertyChangeSupport support
           
 
Constructor Summary
IntervalMarker()
          Zero-argument Constructor.
IntervalMarker(Chart newChart)
          Create a marker and set the Chart object to which this marker applies
IntervalMarker(Chart newChart, double min, double max, Paint paint)
          Create an IntervalMarker and set some properties
IntervalMarker(Chart newChart, Orientation orientation, double min, double max, Paint paint)
          Create an IntervalMarker and set properties
 
Method Summary
 void addPropertyChangeListener(PropertyChangeListener listener)
          Registers the interest of an object in the property changes of this object
protected  Paint createHorizontalPaint(Chart chart, int pixelYMin, int pixelYMax)
          By default simply returns the paint property, but this protected method gives you an opportunity to override this behaviour and, if required, create a Paint that varies depending on the IntervalMarker's pixel height.
protected  Paint createVerticalPaint(Chart chart, int pixelXMin, int pixelXMax)
          By default simply returns the paint property, but this protected method gives you an opportunity to override this behaviour and, if required, create a Paint that varies depending on the IntervalMarker's pixel width.
 void draw(Graphics g)
          The callback method to draw the object.
 Chart getChart()
          Returns the Chart object with which this Interval marker is associated
 Color getColor()
          Returns the color of the marker object.
 String getLabel()
          Returns the text label associated with this marker, if any
 Color getLabelColor()
          Returns the current color setting for the label
 Font getLabelFont()
          Returns the font used for displaying the label
 LabelPlacement getLabelPlacement()
          Returns the current positioning of the label
 double getMax()
          Returns the maximum value of the range
 double getMin()
          Returns the minimum value of the range
 Orientation getOrientation()
          Returns the orientation of the interval
 Color getOutlineColor()
          Returns the color used for the outline (if there is one).
 Stroke getOutlineStroke()
          Returns the stroke used for the outline
 Paint getPaint()
          Returns the paint used for the marker object
 int getZOrder()
           
 boolean isAtFront()
          A method of the Frontable interface.
 boolean isShadowVisible()
          Whether the object is to drawn with a shadow
 boolean isVisible()
          Returns whether the marker object is currently visible
 void removePropertyChangeListener(PropertyChangeListener listener)
          De-register the interest of an object in the property changes of this object
 void setAtFront(boolean atFront)
          Specify whether the marker should be drawn in front of the Chart Models in the chart
 void setChart(Chart chart)
          Sets the chart object that this marker will be drawn on
 void setColor(Color color)
          Specify the fill color of the marker object
 void setInterval(double min, double max)
          Sets the interval with minimum and maximum values
 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 setMax(double max)
          Specify the maximum value for the interval
 void setMin(double min)
          Specify the minimum value for the interval
 void setOrientation(Orientation orientation)
          If the orientation of the interval is vertical it means it is applied to the x axis; if horizontal it is applied to the y axis.
 void setOutlineColor(Color outlineColor)
          Specify an outline color for the marker
 void setOutlineStroke(Stroke outlineStroke)
          Specify a stroke to use for the outline of the marker.
 void setPaint(Paint paint)
          Specify the paint to use for the marker object.
 void setShadowVisible(boolean shadowVisible)
          Specify whether the object should be drawn with a shadow.
 void setVisible(boolean visible)
          Specify whether this marker object should be drawn.
 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_VISIBLE

public static final String PROPERTY_VISIBLE
The name of the property to indicate whether the IntervalMarker is visible

See Also:
Constant Field Values

PROPERTY_ORIENTATION

public static final String PROPERTY_ORIENTATION
The name of the property that indicates the orientation of the IntervalMarker

See Also:
Constant Field Values

PROPERTY_CHART

public static final String PROPERTY_CHART
The name of the property that holds the corresponding chart

See Also:
Constant Field Values

PROPERTY_COLOR

public static final String PROPERTY_COLOR
The name of the property used for the color of the marker (same as paint if the paint is a java.awt.Color)

See Also:
Constant Field Values

PROPERTY_PAINT

public static final String PROPERTY_PAINT
The name of the property used for the paint of the marker

See Also:
Constant Field Values

PROPERTY_MAX

public static final String PROPERTY_MAX
The name of the property used for the upper limit of the interval marker

See Also:
Constant Field Values

PROPERTY_MIN

public static final String PROPERTY_MIN
The name of the property used for the lower limit of the interval marker

See Also:
Constant Field Values

PROPERTY_LABEL

public static final String PROPERTY_LABEL
The name of the property used for the label of the IntervalMarker

See Also:
Constant Field Values

PROPERTY_LABEL_PLACEMENT

public static final String PROPERTY_LABEL_PLACEMENT
The name of the property used for the placement of the label

See Also:
Constant Field Values

PROPERTY_LABEL_COLOR

public static final String PROPERTY_LABEL_COLOR
The name of the property used for the color of the label

See Also:
Constant Field Values

PROPERTY_LABEL_FONT

public static final String PROPERTY_LABEL_FONT
The name of the property used for the font of the label

See Also:
Constant Field Values

PROPERTY_AT_FRONT

public static final String PROPERTY_AT_FRONT
The name of the property used to indicate whether the marker is at the front or behind the chart models

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

PROPERTY_SHADOW_VISIBLE

public static final String PROPERTY_SHADOW_VISIBLE
The name of the property used for the shadow visibility

See Also:
Constant Field Values

support

protected final PropertyChangeSupport support
Constructor Detail

IntervalMarker

public IntervalMarker()
Zero-argument Constructor. Usually you would create an IntervalMarker with one of the other constructors that sets properties at object creation time.


IntervalMarker

public IntervalMarker(Chart newChart)
Create a marker and set the Chart object to which this marker applies

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

IntervalMarker

public IntervalMarker(Chart newChart,
                      double min,
                      double max,
                      Paint paint)
Create an IntervalMarker and set some properties

Parameters:
newChart - the chart to which this marker applies
min - the minimum value for the interval
max - the maximum value for the interval
paint - the color or other paint for the interval

IntervalMarker

public IntervalMarker(Chart newChart,
                      Orientation orientation,
                      double min,
                      double max,
                      Paint paint)
Create an IntervalMarker and set properties

Parameters:
newChart - the chart to which this marker applies
orientation - the orientation of the interval. Effectively this specifies whether the interval applies to the x or the y axis
min - the minimum value for the interval
max - the maximum value for the interval
paint - the paint fill to use for the interval
Method Detail

addPropertyChangeListener

public void addPropertyChangeListener(PropertyChangeListener listener)
Registers the interest of an object in the property changes of this object

Parameters:
listener - the interested object

removePropertyChangeListener

public void removePropertyChangeListener(PropertyChangeListener listener)
De-register the interest of an object in the property changes of this object

Parameters:
listener - the object that is no longer interested in property changes

getChart

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

Returns:
the Chart object with which this Interval marker is associated

setChart

public void setChart(Chart chart)
Sets the chart object that this marker will be drawn on

Parameters:
chart - sets the Chart object with which this Interval marker is associated

isVisible

public boolean isVisible()
Returns whether the 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. If a paint is used that is not a color, this returns null.

setColor

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

Parameters:
color - the fill color of the marker object

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.

getOrientation

public Orientation getOrientation()
Returns the orientation of the interval

Returns:
the orientation of the interval

setOrientation

public void setOrientation(Orientation orientation)
If the orientation of the interval is vertical it means it is applied to the x axis; if horizontal it is applied to the y axis.

Parameters:
orientation - the orientation of the interval

getZOrder

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

setZOrder

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

getMin

public double getMin()
Returns the minimum value of the range

Returns:
the minimum value of the range

getMax

public double getMax()
Returns the maximum value of the range

Returns:
the maximum value of the range

setMin

public void setMin(double min)
Specify the minimum value for the interval

Parameters:
min - the new minimum

setMax

public void setMax(double max)
Specify the maximum value for the interval

Parameters:
max - the new maximum

setInterval

public void setInterval(double min,
                        double max)
Sets the interval with minimum and maximum values

Parameters:
min - the new minimum for the interval
max - the new maximum for the interval

getLabel

public String getLabel()
Returns the text label associated with this marker, if any

Returns:
the text label associated with this marker

setLabel

public void setLabel(String label)
Specify a text label for the marker


getLabelPlacement

public LabelPlacement getLabelPlacement()
Returns the current positioning 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. By default the label is placed in the centre of the IntervalMarker.

Parameters:
labelPlacement - where to place the label

getLabelColor

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

Returns:
the current color setting for the label

setLabelColor

public void setLabelColor(Color labelColor)
Specify the color to use for the label. The default color is black.

Parameters:
labelColor - the color to use for the label

getLabelFont

public Font getLabelFont()
Returns the font used for displaying 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 color used for the outline (if there is one). If no outline is being used, this returns null.

Returns:
the color of the outline, or null if no color is being used

setOutlineColor

public void setOutlineColor(Color outlineColor)
Specify an outline color for the marker

Parameters:
outlineColor - the color to be used for the outline

getOutlineStroke

public Stroke getOutlineStroke()
Returns the stroke used for the outline

Returns:
the stroke used for the outline

setOutlineStroke

public void setOutlineStroke(Stroke outlineStroke)
Specify a stroke to use for the outline of the marker. If not supplied, a default Stroke is used with a solid line of width 1.

Parameters:
outlineStroke - the stroke to use for the outline

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

createHorizontalPaint

protected Paint createHorizontalPaint(Chart chart,
                                      int pixelYMin,
                                      int pixelYMax)
By default simply returns the paint property, but this protected method gives you an opportunity to override this behaviour and, if required, create a Paint that varies depending on the IntervalMarker's pixel height.

Parameters:
chart - the chart instance
pixelYMin - the pixel y value corresponding to the minimum value of the interval marker's range
pixelYMax - the pixel y value corresponding to the maximum value of the interval marker's range
Returns:
a Paint instance used for filling the IntervalMarker

createVerticalPaint

protected Paint createVerticalPaint(Chart chart,
                                    int pixelXMin,
                                    int pixelXMax)
By default simply returns the paint property, but this protected method gives you an opportunity to override this behaviour and, if required, create a Paint that varies depending on the IntervalMarker's pixel width.

Parameters:
chart - the chart instance
pixelXMin - the pixel x value corresponding to the minimum value of the interval marker's range
pixelXMax - the pixel x value corresponding to the maximum value of the interval marker's range
Returns:
a Paint instance used for filling the IntervalMarker

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 in the chart

setAtFront

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

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

isShadowVisible

public boolean isShadowVisible()
Description copied from interface: Shadowable
Whether the object is to drawn with a shadow

Specified by:
isShadowVisible in interface Shadowable
Returns:
true if the object is to be drawn with a shadow; false if to be drawn without a shadow

setShadowVisible

public void setShadowVisible(boolean shadowVisible)
Description copied from interface: Shadowable
Specify whether the object should be drawn with a shadow.

Specified by:
setShadowVisible in interface Shadowable
Parameters:
shadowVisible - whether the object should have a shadow

JIDE 3.5.15