Class HighlightableDataset

All Implemented Interfaces:
Data, Drawable, Interactive, LogMeasurable, Measurable

public class HighlightableDataset extends Dataset implements Interactive
A Dataset that can highlight selected points.
Version:
1.0
Author:
Doug Brown
  • Constructor Details

    • HighlightableDataset

      public HighlightableDataset()
      Default constructor.
    • HighlightableDataset

      public HighlightableDataset(Color markerColor)
      Constructor specifying the marker color.
      Parameters:
      markerColor - marker color
  • Method Details

    • clear

      public void clear()
      Clear all data from this Dataset.
      Overrides:
      clear in class Dataset
    • restoreHighlights

      public void restoreHighlights()
      Restores previous highlights.
    • clearHighlights

      public void clearHighlights()
      Clears highlights.
    • setHighlighted

      public void setHighlighted(int i, boolean highlight)
      Sets the highlighted flag for the specified point.
      Parameters:
      i - the array index
      highlight - true to highlight the point
    • isHighlighted

      public boolean isHighlighted(int n)
      Gets the highlighted flag for the specified point.
      Parameters:
      n - the array index
      Returns:
      true if point is highlighted
    • setHighlightColor

      public void setHighlightColor(Color color)
      Sets the highlight color.
      Parameters:
      color - the color
    • draw

      public void draw(DrawingPanel drawingPanel, Graphics g)
      Draw this Dataset in the drawing panel.
      Specified by:
      draw in interface Drawable
      Overrides:
      draw in class Dataset
      Parameters:
      drawingPanel - the drawing panel
      g - the graphics
    • findInteractive

      public Interactive findInteractive(DrawingPanel panel, int xpix, int ypix)
      Returns the Interactive object at a specified pixel position. Implements Interactive.
      Specified by:
      findInteractive in interface Interactive
      Parameters:
      panel - the drawing panel
      xpix - the x pixel position on the panel
      ypix - the y pixel position on the panel
      Returns:
      the object
    • getHitIndex

      public int getHitIndex()
      Gets the most recent hit index.
      Returns:
      the hit index
    • getScreenCoordinates

      public double[][] getScreenCoordinates()
      Gets the screen coordinates of all data points.
      Returns:
      screen coordinates
    • setEnabled

      public void setEnabled(boolean enabled)
      Implements Interactive.
      Specified by:
      setEnabled in interface Interactive
      Parameters:
      enabled - ignored
    • isEnabled

      public boolean isEnabled()
      Implements Interactive.
      Specified by:
      isEnabled in interface Interactive
      Returns:
      true
    • setXY

      public void setXY(double x, double y)
      Implements Interactive.
      Specified by:
      setXY in interface Interactive
      Parameters:
      x - ignored
      y - ignored
    • setX

      public void setX(double x)
      Implements Interactive.
      Specified by:
      setX in interface Interactive
      Parameters:
      x - ignored
    • setY

      public void setY(double y)
      Implements Interactive.
      Specified by:
      setY in interface Interactive
      Parameters:
      y - ignored
    • getX

      public double getX()
      Implements Interactive.
      Specified by:
      getX in interface Interactive
      Returns:
      the x value at the current hit index, or Double.NaN if none
    • getY

      public double getY()
      Implements Interactive.
      Specified by:
      getY in interface Interactive
      Returns:
      the y value at the current hit index, or Double.NaN if none
    • getLoader

      public static XML.ObjectLoader getLoader()
      Returns the XML.ObjectLoader for this class.
      Returns:
      the object loader
    • setHighlights

      public void setHighlights(BitSet bs)
    • getHighlightedBS

      public BitSet getHighlightedBS()
    • getHighlightCount

      public int getHighlightCount()
    • getValidYCount

      public int getValidYCount()