java.lang.Object
org.bzdev.graphs.Graph.Symbol
- Enclosing class:
- Graph
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 -
Method Summary
Modifier and TypeMethodDescriptiongetColor()
Get the symbol colorprotected 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 symboldouble
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
Set the symbol colorvoid
setErrorBarTab
(double width) Set the total tab width for an error bar.void
setLineThickness
(double thickness) Set the line thickness for drawing the symbolvoid
setScaleFactor
(double scaleFactor) Set the scale factor for the symbol.
-
Constructor Details
-
Symbol
protected Symbol()Constructor.
-
-
Method Details
-
setColor
Set the symbol color- Parameters:
color
- the color for the symbol
-
getColor
Get the symbol color- Returns:
- the color for the symbol
-
setLineThickness
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
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
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):
Note that error bars can be vertical or horizontal, and that some symbols may require both.. _______ . | . | . | . o . | . | . ___|___ .
- 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):
Note that error bars can be vertical or horizontal, and that some symbols may require both.. _______ . | . | . | . o . | . | . ___|___ .
- 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 spaceyAxisPointsDown
- 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 spaceyAxisPointsDown
- 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 spaceyAxisPointsDown
- 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 spaceyAxisPointsDown
- 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 spaceyAxisPointsDown
- 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
-