JIDE 3.5.15

com.jidesoft.chart
Class LineMarker

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

public class LineMarker
extends Object
implements Drawable, Frontable

A marker that can be added to a chart and is drawn as either a horizontal or vertical line across the chart.

Note that if a LineMarker 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 that indicates whether the marker is in front of the 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 for the text of the label
static String PROPERTY_LABEL_COLOR
          The name of the property for the color of the label
static String PROPERTY_LABEL_FONT
          The name of the property for the font of the label
static String PROPERTY_LABEL_PLACEMENT
          The name of the property for the placement of the label
static String PROPERTY_ORIENTATION
          The name of the property that indicates the orientation of the IntervalMarker
static String PROPERTY_POSITION
          The name of the property that indicates the position of the line.
static String PROPERTY_STROKE
          The name of the property describing the Stroke of the line
static String PROPERTY_VISIBLE
          The name of the property to indicate whether the IntervalMarker is visible
protected  PropertyChangeSupport support
           
 
Constructor Summary
LineMarker()
          Zero argument constructor.
LineMarker(Chart newChart)
          Create a marker and set the Chart object to which this marker applies
LineMarker(Chart newChart, Orientation orientation, double position, Color color)
          Create a LineMarker and set some properties
 
Method Summary
 void addPropertyChangeListener(PropertyChangeListener listener)
          Registers the interest of an object in property changes of the LineMarker
 void draw(Graphics g)
          The callback method to draw the object.
 Chart getChart()
          Returns the chart object with which this marker is associated
 Color getColor()
          Returns the color of the LineMarker
 String getLabel()
          Returns the text of the label
 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
 Orientation getOrientation()
          Returns the orientation of the LineMarker
 double getPosition()
          Returns the position of the marker along the axis
 Stroke getStroke()
          Returns the stroke used for drawing the line
 boolean isAtFront()
          A method of the Frontable interface.
 boolean isVisible()
          Returns whether the marker is currently painted onto the chart's Graphics context when an update occurs
 void removePropertyChangeListener(PropertyChangeListener listener)
          De-registers the interest of an object that is already registered as a property listener
 void setAtFront(boolean atFront)
          You can use this method to specify whether the line marker should be drawn at the front of the chart models or at the back.
 void setChart(Chart chart)
          Specify the chart object with which this marker is associated
 void setColor(Color color)
          Specify the color for the LineMarker
 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 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 setPosition(double pos)
          Specify the position of the marker along the axis
 void setRenderingHint(RenderingHints.Key hint, Object value)
           
 void setStroke(Stroke stroke)
          Specify the stroke for the line
 void setVisible(boolean visible)
          Specify whether the marker should be painted
 
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_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_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_POSITION

public static final String PROPERTY_POSITION
The name of the property that indicates the position of the line.

See Also:
Constant Field Values

PROPERTY_STROKE

public static final String PROPERTY_STROKE
The name of the property describing the Stroke of the line

See Also:
Constant Field Values

PROPERTY_LABEL

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

See Also:
Constant Field Values

PROPERTY_LABEL_PLACEMENT

public static final String PROPERTY_LABEL_PLACEMENT
The name of the property 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 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 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 that indicates whether the marker is in front of the models

See Also:
Constant Field Values

support

protected final PropertyChangeSupport support
Constructor Detail

LineMarker

public LineMarker()
Zero argument constructor. Usually you would construct a LineMarker by using one of the other constructors that automatically set property values at object construction time.


LineMarker

public LineMarker(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

LineMarker

public LineMarker(Chart newChart,
                  Orientation orientation,
                  double position,
                  Color color)
Create a LineMarker and set some properties

Parameters:
newChart - the chart to which this marker applies
orientation - the orientation of the line
position - the position on the appropriate axis
color - the color for the line
Method Detail

addPropertyChangeListener

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

Parameters:
listener - the object interested interested in property changes

removePropertyChangeListener

public void removePropertyChangeListener(PropertyChangeListener listener)
De-registers the interest of an object that is already registered as a property listener

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

getLabel

public String getLabel()
Returns the text of the label

Returns:
the text of the label

setLabel

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

Parameters:
label - the text of the label

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

Parameters:
labelPlacement - the parameter that specifies 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. If the color is not specified, the same color will be used as for the line.

Parameters:
labelColor - the color of 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

getChart

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

Returns:
the chart object with which this marker is associated

setChart

public void setChart(Chart chart)
Specify the chart object with which this marker is associated

Parameters:
chart - the chart object

setRenderingHint

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

isVisible

public boolean isVisible()
Returns whether the marker is currently painted onto the chart's Graphics context when an update occurs

Returns:
whether the marker is currently painted onto the chart's Graphics context when an update occurs

setVisible

public void setVisible(boolean visible)
Specify whether the marker should be painted

Parameters:
visible - the visibility of the marker

getColor

public Color getColor()
Returns the color of the LineMarker

Returns:
the color of the LineMarker

setColor

public void setColor(Color color)
Specify the color for the LineMarker

Parameters:
color - the new color for the line marker

getStroke

public Stroke getStroke()
Returns the stroke used for drawing the line

Returns:
the stroke used for drawing the line

setStroke

public void setStroke(Stroke stroke)
Specify the stroke for the line

Parameters:
stroke - the new Stroke

getOrientation

public Orientation getOrientation()
Returns the orientation of the LineMarker

Returns:
the orientation of the LineMarker

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 line

getPosition

public double getPosition()
Returns the position of the marker along the axis

Returns:
the position of the marker along the axis

setPosition

public void setPosition(double pos)
Specify the position of the marker along the axis

Parameters:
pos - the new position

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 this returns false, unless you have set it using the setAtFront() method.

Specified by:
isAtFront in interface Frontable
Returns:
whether the line marker should be displayed in front of the chart models

setAtFront

public void setAtFront(boolean atFront)
You can use this method to specify whether the line marker should be drawn at the front of the chart models or at the back.

Specified by:
setAtFront in interface Frontable
Parameters:
atFront - specify whether the marker should be drawn in front of the chart models

JIDE 3.5.15