public class Line extends Figure
Constructor and Description |
---|
Line(Coordinate start,
Coordinate end)
Constructor
|
Line(Coordinate start,
Coordinate end,
PathInfo info)
Constructor
|
Line(long startTime,
double startValue,
long endTime,
double endValue)
Constructor.
|
Line(long startTime,
double startValue,
long endTime,
double endValue,
PathInfo info)
Constructor.
|
Modifier and Type | Method and Description |
---|---|
boolean |
contains(double x,
double y,
DrawContext ctx)
Returns true if the line contains the given x and y coordinates within the given draw context.
|
void |
draw(java.awt.Graphics2D gc,
DrawContext ctx)
Draws the line (this is called by the study framework).
|
java.awt.Color |
getColor()
Gets the color of the line.
|
long |
getEndTime()
Gets the time of the ending location of the line.
|
double |
getEndValue()
Gets the value of the ending location of the line.
|
int |
getExtendLeft()
Gets the number of bars to extend past the start point.
|
int |
getExtendRight()
Gets the number of bars to extend past the end point.
|
long |
getStartTime()
Gets the time of the starting location of the line.
|
double |
getStartValue()
Gets the value of the starting location of the line.
|
java.awt.Stroke |
getStroke()
Gets the stroke for displaying the line.
|
Text |
getText() |
boolean |
isExtendLeftBounds()
Returns true if the line should be extended to the left bounds of the plot.
|
boolean |
isExtendRightBounds()
Returns true if the line should be extended to the right bounds of the plot.
|
boolean |
isVisible(DrawContext ctx)
Returns true if the line is currently visible within the given draw context.
|
void |
layout(DrawContext ctx)
Lays out the line by converting the start and end coordinates to x,y
coordinates on the graph.
|
void |
setColor(java.awt.Color color)
Sets the color of the line.
|
void |
setColorAbove(double value,
java.awt.Color color)
Use this method to change the color of the line when it is above a given value.
|
void |
setColorBelow(double value,
java.awt.Color color)
Use this method to change the color of the line when it is below a given value.
|
void |
setEnd(long time,
double value)
Sets the location of the end of the line.
|
void |
setExtendLeft(int bars)
Sets the number of bars to extend past the start point
|
void |
setExtendLeftBounds(boolean b)
Extends the line to the left bounds of the plot.
|
void |
setExtendRight(int bars)
Sets the number of bars to extend past the end point.
|
void |
setExtendRightBounds(boolean b)
Extends the line to the right bounds of the plot.
|
void |
setStart(long time,
double value)
Sets the location of the start of the line.
|
void |
setStroke(java.awt.Stroke stroke)
Sets the stroke for displaying the line.
|
void |
setText(java.lang.String text,
java.awt.Font font)
Sets the text to be displayed in the center of the line.
|
public Line(Coordinate start, Coordinate end)
start
- starting location of the lineend
- ending location of the linepublic Line(Coordinate start, Coordinate end, PathInfo info)
start
- starting location of the lineend
- ending location of the lineinfo
- describes how to display the line.public Line(long startTime, double startValue, long endTime, double endValue)
startTime
- startValue
- endTime
- endValue
- public Line(long startTime, double startValue, long endTime, double endValue, PathInfo info)
startTime
- startValue
- endTime
- endValue
- info
- public void setStart(long time, double value)
time
- time (as milliseconds since 1970)value
- (y coordinate)public long getStartTime()
public double getStartValue()
public void setEnd(long time, double value)
time
- time (as milliseconds since 1970)value
- (y coordinate)public long getEndTime()
public double getEndValue()
public Text getText()
public void setText(java.lang.String text, java.awt.Font font)
text
- text valuefont
- display fontpublic java.awt.Color getColor()
public void setColor(java.awt.Color color)
color
- line colorpublic void setStroke(java.awt.Stroke stroke)
stroke
- public java.awt.Stroke getStroke()
public void setExtendLeft(int bars)
bars
- number bars to extend to the leftpublic int getExtendLeft()
public void setExtendRight(int bars)
bars
- number of bars to extend rightpublic int getExtendRight()
public void setExtendRightBounds(boolean b)
b
- true if the line should be extended to the right bounds of the plot.public boolean isExtendRightBounds()
public void setExtendLeftBounds(boolean b)
b
- true if the line should be extended to the left bounds of the plot.public boolean isExtendLeftBounds()
public void setColorAbove(double value, java.awt.Color color)
value
- value to color abovecolor
- color to usepublic void setColorBelow(double value, java.awt.Color color)
value
- value to color belowcolor
- color to usepublic boolean isVisible(DrawContext ctx)
public boolean contains(double x, double y, DrawContext ctx)
public void layout(DrawContext ctx)
public void draw(java.awt.Graphics2D gc, DrawContext ctx)