# Header
And More

## org.jfree.chart.panel
Class CrosshairOverlay

    java.lang.Object
      org.jfree.chart.panel.AbstractOverlay
          org.jfree.chart.panel.CrosshairOverlay

All Implemented Interfaces:
  java.beans.PropertyChangeListener, java.io.Serializable, java.lang.Cloneable, java.util.EventListener, Overlay, org.jfree.util.PublicCloneable

    public class CrosshairOverlay

extends AbstractOverlay
implements Overlay, java.beans.PropertyChangeListener, org.jfree.util.PublicCloneable, java.lang.Cloneable, java.io.Serializable

An overlay for a `ChartPanel` that draws crosshairs on a plot.

Since:
  1.0.13
See Also:
  Serialized Form

Constructor Summary
`CrosshairOverlay()` Default constructor.

Method Summary
`void` `addDomainCrosshair(Crosshair crosshair)` Adds a crosshair against the domain axis.
`void` `addRangeCrosshair(Crosshair crosshair)` Adds a crosshair against the range axis.
`void` `clearDomainCrosshairs()`
`void` `clearRangeCrosshairs()`
`java.lang.Object` `clone()` Returns a clone of this instance.
`protected void` `drawHorizontalCrosshair(java.awt.Graphics2D g2, java.awt.geom.Rectangle2D dataArea, double y, Crosshair crosshair)` Draws a crosshair horizontally across the plot.
`protected void` `drawVerticalCrosshair(java.awt.Graphics2D g2, java.awt.geom.Rectangle2D dataArea, double x, Crosshair crosshair)` Draws a crosshair vertically on the plot.
`boolean` `equals(java.lang.Object obj)` Tests this overlay for equality with an arbitrary object.
`java.util.List` `getDomainCrosshairs()`
`java.util.List` `getRangeCrosshairs()`
`void` `paintOverlay(java.awt.Graphics2D g2, ChartPanel chartPanel)` Paints the crosshairs in the layer.
`void` `propertyChange(java.beans.PropertyChangeEvent e)` Receives a property change event (typically a change in one of the crosshairs).
`void` `removeDomainCrosshair(Crosshair crosshair)`
`void` `removeRangeCrosshair(Crosshair crosshair)`

Methods inherited from class org.jfree.chart.panel.AbstractOverlay
`addChangeListener, fireOverlayChanged, notifyListeners, removeChangeListener`

Methods inherited from class java.lang.Object
`finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait`

Methods inherited from interface org.jfree.chart.panel.Overlay
`addChangeListener, removeChangeListener`

Constructor Detail

### CrosshairOverlay

    public CrosshairOverlay()

  Default constructor.

Method Detail

### addDomainCrosshair

    public void addDomainCrosshair(Crosshair crosshair)

  Adds a crosshair against the domain axis.

  Parameters:
    `crosshair` - the crosshair.

### removeDomainCrosshair

    public void removeDomainCrosshair(Crosshair crosshair)

### clearDomainCrosshairs

    public void clearDomainCrosshairs()

### getDomainCrosshairs

    public java.util.List getDomainCrosshairs()

### addRangeCrosshair

    public void addRangeCrosshair(Crosshair crosshair)

  Adds a crosshair against the range axis.

  Parameters:
    `crosshair` - the crosshair.

### removeRangeCrosshair

    public void removeRangeCrosshair(Crosshair crosshair)

### clearRangeCrosshairs

    public void clearRangeCrosshairs()

### getRangeCrosshairs

    public java.util.List getRangeCrosshairs()

### propertyChange

    public void propertyChange(java.beans.PropertyChangeEvent e)

  Receives a property change event (typically a change in one of the crosshairs).

  Specified by:
    `propertyChange` in interface `java.beans.PropertyChangeListener`
  Parameters:
    `e` - the event.

### paintOverlay

    public void paintOverlay(java.awt.Graphics2D g2,
                             ChartPanel chartPanel)

  Paints the crosshairs in the layer.

  Specified by:
    `paintOverlay` in interface `Overlay`
  Parameters:
    `g2` - the graphics target.
    `chartPanel` - the chart panel.

### drawHorizontalCrosshair

    protected void drawHorizontalCrosshair(java.awt.Graphics2D g2,
                                           java.awt.geom.Rectangle2D dataArea,
                                           double y,
                                           Crosshair crosshair)

  Draws a crosshair horizontally across the plot.

  Parameters:
    `g2` - the graphics target.
    `dataArea` - the data area.
    `y` - the y-value in Java2D space.
    `crosshair` - the crosshair.

### drawVerticalCrosshair

    protected void drawVerticalCrosshair(java.awt.Graphics2D g2,
                                         java.awt.geom.Rectangle2D dataArea,
                                         double x,
                                         Crosshair crosshair)

  Draws a crosshair vertically on the plot.

  Parameters:
    `g2` - the graphics target.
    `dataArea` - the data area.
    `x` - the x-value in Java2D space.
    `crosshair` - the crosshair.

### equals

    public boolean equals(java.lang.Object obj)

  Tests this overlay for equality with an arbitrary object.

  Overrides:
    `equals` in class `java.lang.Object`
  Parameters:
    `obj` - the object (`null` permitted).
  Returns:
    A boolean.

### clone

    public java.lang.Object clone()
                           throws java.lang.CloneNotSupportedException

  Returns a clone of this instance.

  Specified by:
    `clone` in interface `org.jfree.util.PublicCloneable`
  Overrides:
    `clone` in class `java.lang.Object`
  Returns:
    A clone of this instance.
  Throws:
    `java.lang.CloneNotSupportedException` - if there is some problem with the cloning.

# Footer
And More

Copyright © 2000-2009 by Object Refinery Limited. All Rights Reserved.