Class Cursor
- java.lang.Object
-
- java.awt.event.MouseAdapter
-
- org.knowm.xchart.internal.chartpart.Cursor
-
- All Implemented Interfaces:
java.awt.event.MouseListener,java.awt.event.MouseMotionListener,java.awt.event.MouseWheelListener,java.util.EventListener,ChartPart
public class Cursor extends java.awt.event.MouseAdapter implements ChartPart
Cursor movement to display matching point data information.
-
-
Nested Class Summary
Nested Classes Modifier and Type Class Description private static classCursor.DataPoint
-
Field Summary
Fields Modifier and Type Field Description private Chartchartprivate java.util.List<Cursor.DataPoint>dataPointListprivate static intLINE_SPACINGprivate java.util.List<Cursor.DataPoint>matchingDataPointListprivate static intMOUSE_SPACINGprivate doublemouseXprivate doublemouseYprivate java.util.Map<java.lang.String,Series>seriesMapprivate doublestartXprivate doublestartYprivate XYStylerstylerprivate doubletextHeight-
Fields inherited from interface org.knowm.xchart.internal.chartpart.ChartPart
SOLID_STROKE
-
-
Method Summary
All Methods Instance Methods Concrete Methods Modifier and Type Method Description (package private) voidaddData(double xOffset, double yOffset, java.lang.String xValue, java.lang.String yValue, java.lang.String seriesName)private voidcalculateMatchingDataPoints()One DataPoint per series, keep the DataPoint closest to mouseXjava.awt.geom.Rectangle2DgetBounds()private booleanisMouseOutOfPlotContent()voidmouseMoved(java.awt.event.MouseEvent e)voidpaint(java.awt.Graphics2D g)private voidpaintBackGround(java.awt.Graphics2D g, java.awt.font.TextLayout xValueTextLayout)private voidpaintDataPointInfo(java.awt.Graphics2D g, java.awt.font.TextLayout xValueTextLayout)private voidpaintVerticalLine(java.awt.Graphics2D g, Cursor.DataPoint dataPoint)
-
-
-
Field Detail
-
LINE_SPACING
private static final int LINE_SPACING
- See Also:
- Constant Field Values
-
MOUSE_SPACING
private static final int MOUSE_SPACING
- See Also:
- Constant Field Values
-
dataPointList
private final java.util.List<Cursor.DataPoint> dataPointList
-
matchingDataPointList
private final java.util.List<Cursor.DataPoint> matchingDataPointList
-
chart
private final Chart chart
-
styler
private final XYStyler styler
-
seriesMap
private final java.util.Map<java.lang.String,Series> seriesMap
-
mouseX
private double mouseX
-
mouseY
private double mouseY
-
startX
private double startX
-
startY
private double startY
-
textHeight
private double textHeight
-
-
Constructor Detail
-
Cursor
public Cursor(Chart chart)
Constructor- Parameters:
chart-
-
-
Method Detail
-
mouseMoved
public void mouseMoved(java.awt.event.MouseEvent e)
- Specified by:
mouseMovedin interfacejava.awt.event.MouseMotionListener- Overrides:
mouseMovedin classjava.awt.event.MouseAdapter
-
isMouseOutOfPlotContent
private boolean isMouseOutOfPlotContent()
-
getBounds
public java.awt.geom.Rectangle2D getBounds()
-
paintVerticalLine
private void paintVerticalLine(java.awt.Graphics2D g, Cursor.DataPoint dataPoint)
-
paintBackGround
private void paintBackGround(java.awt.Graphics2D g, java.awt.font.TextLayout xValueTextLayout)
-
paintDataPointInfo
private void paintDataPointInfo(java.awt.Graphics2D g, java.awt.font.TextLayout xValueTextLayout)
-
addData
void addData(double xOffset, double yOffset, java.lang.String xValue, java.lang.String yValue, java.lang.String seriesName)
-
calculateMatchingDataPoints
private void calculateMatchingDataPoints()
One DataPoint per series, keep the DataPoint closest to mouseX
-
-