Class Graph.Symbol

java.lang.Object
org.bzdev.graphs.Graph.Symbol
Enclosing class:
Graph

public abstract static class Graph.Symbol extends Object
Class for symbols used in plotting. A symbol is used to label a data point on a graph and error bars may be added to the symbol if needed. The symbols can be scaled. Subclasses should create symbols with a default size (corresponding to a scale factor of 1.0) that fits in a bounding box 10.0 user-space units on a side and centered on (0.0, 0.0).
  • Constructor Summary

    Constructors
    Modifier
    Constructor
    Description
    protected
    Constructor.
  • Method Summary

    Modifier and Type
    Method
    Description
    Get the symbol color
    protected abstract double
    getEBarStartBottom(boolean xAxisPointsRight, boolean yAxisPointsDown)
    Get the lower Y coordinate for a vertical error bar.
    protected abstract double
    getEBarStartLeft(boolean xAxisPointsRight, boolean yAxisPointsDown)
    Get the left X coordinate for a horizontal error bar.
    protected abstract double
    getEBarStartRight(boolean xAxisPointsRight, boolean yAxisPointsDown)
    Get the right X coordinate for a horizontal error bar.
    protected abstract double
    getEBarStartTop(boolean xAxisPointsRight, boolean yAxisPointsDown)
    Get the upper Y coordinate for a vertical error bar.
    double
    Get the total tab width for an error bar.
    double
    Get the line thickness for drawing the symbol
    double
    Get the scale factor for the symbol.
    protected abstract Graph.UserGraphic
    getUserGraphic(boolean xAxisPointsRight, boolean yAxisPointsDown)
    Get a UserGraphic representing a shape to draw.
    void
    setColor(Color color)
    Set the symbol color
    void
    setErrorBarTab(double width)
    Set the total tab width for an error bar.
    void
    setLineThickness(double thickness)
    Set the line thickness for drawing the symbol
    void
    setScaleFactor(double scaleFactor)
    Set the scale factor for the symbol.

    Methods inherited from class java.lang.Object

    clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
  • Constructor Details

    • Symbol

      protected Symbol()
      Constructor.
  • Method Details

    • setColor

      public void setColor(Color color)
      Set the symbol color
      Parameters:
      color - the color for the symbol
    • getColor

      public Color getColor()
      Get the symbol color
      Returns:
      the color for the symbol
    • setLineThickness

      public void setLineThickness(double thickness) throws IllegalArgumentException
      Set the line thickness for drawing the symbol
      Parameters:
      thickness - the line thickness, a positive number, in user-space units
      Throws:
      IllegalArgumentException - the argument is out of range
    • getLineThickness

      public double getLineThickness()
      Get the line thickness for drawing the symbol
      Returns:
      the line thickness in user-space units
    • setScaleFactor

      public void setScaleFactor(double scaleFactor) throws IllegalArgumentException
      Set the scale factor for the symbol. Symbols have a natural size for error bars. This size will be multiplied by the scale factor when drawing error bars.
      Parameters:
      scaleFactor - the scale factor, a positive number
      Throws:
      IllegalArgumentException - the argument is out of range
    • getScaleFactor

      public double getScaleFactor()
      Get the scale factor for the symbol. Symbols have a natural size for error bars. This size will be multiplied by the scale factor when drawing error bars.
      Returns:
      the scale factor
    • setErrorBarTab

      public void setErrorBarTab(double width) throws IllegalArgumentException
      Set the total tab width for an error bar. The tab width is the length of the lines at the ends of an error bar (the horizontal lines in the following figure):
       .      _______
       .         |
       .         |
       .         |
       .         o
       .         |
       .         |
       .      ___|___
       .
       
      Note that error bars can be vertical or horizontal, and that some symbols may require both.
      Parameters:
      width - the tab width, a positive number, in user-space units
      Throws:
      IllegalArgumentException - the argument is out of range
    • getErrorBarTab

      public double getErrorBarTab()
      Get the total tab width for an error bar. The tab width is the length of the lines at the ends of an error bar (the horizontal lines in the following figure):
       .      _______
       .         |
       .         |
       .         |
       .         o
       .         |
       .         |
       .      ___|___
       .
       
      Note that error bars can be vertical or horizontal, and that some symbols may require both.
      Returns:
      the tab width in user-space units
    • getUserGraphic

      protected abstract Graph.UserGraphic getUserGraphic(boolean xAxisPointsRight, boolean yAxisPointsDown)
      Get a UserGraphic representing a shape to draw. The UserGrapic should fit in a box 10 user-space units on a side and centered at (0.0, 0.0). The scale factor will be applied when the symbol is drawn.
      Parameters:
      xAxisPointsRight - the direction for increasing X coordinates in graph coordinate space points right in user space
      yAxisPointsDown - the direction for increasing Y coordinates in graph coordinate space points down in user space
      Returns:
      the UserDrawable representing the portion of the symbol to be drawn but not necessarily filled; null if there is none
    • getEBarStartLeft

      protected abstract double getEBarStartLeft(boolean xAxisPointsRight, boolean yAxisPointsDown)
      Get the left X coordinate for a horizontal error bar. This is the location of the left edge of the symbol when the Y coordinate is zero. Normally this value will be a negative number.
      Parameters:
      xAxisPointsRight - the direction for increasing X coordinates points right in user space
      yAxisPointsDown - the direction for increasing Y coordinates points down in user space
      Returns:
      the coordinate in user space when the symbol is drawn at (0.0, 0.0) with a scale factor of 1.0
    • getEBarStartRight

      protected abstract double getEBarStartRight(boolean xAxisPointsRight, boolean yAxisPointsDown)
      Get the right X coordinate for a horizontal error bar. This is the location of the right edge of the symbol when the Y coordinate is zero.
      Parameters:
      xAxisPointsRight - the direction for increasing X coordinates points right in user space
      yAxisPointsDown - the direction for increasing Y coordinates points down in user space
      Returns:
      the coordinate in user space when the symbol is drawn at (0.0, 0.0) with a scale factor of 1.0
    • getEBarStartTop

      protected abstract double getEBarStartTop(boolean xAxisPointsRight, boolean yAxisPointsDown)
      Get the upper Y coordinate for a vertical error bar. This is the location of the upper edge of the symbol when the X coordinate is zero. Because of user-space conventions, the upper Y coordinate will have a lower value than the lower y coordinate. Normally this value will be a negative number.
      Parameters:
      xAxisPointsRight - the direction for increasing X coordinates points right in user space
      yAxisPointsDown - the direction for increasing Y coordinates points down in user space
      Returns:
      the coordinate in user space when the symbol is drawn at (0.0, 0.0) with a scale factor of 1.0
    • getEBarStartBottom

      protected abstract double getEBarStartBottom(boolean xAxisPointsRight, boolean yAxisPointsDown)
      Get the lower Y coordinate for a vertical error bar. This is the location of the lower edge of the symbol when the X coordinate is zero.
      Parameters:
      xAxisPointsRight - the direction for increasing X coordinates points right in user space
      yAxisPointsDown - the direction for increasing Y coordinates points down in user space
      Returns:
      the coordinate in user space when the symbol is drawn at (0.0, 0.0) with a scale factor of 1.0