Package com.motivewave.platform.sdk.draw
Class Line
java.lang.Object
com.motivewave.platform.sdk.draw.Figure
com.motivewave.platform.sdk.draw.Line
Draws a line over the given start and end coordinates.
-
Constructor Summary
ConstructorsConstructorDescriptionLine
(long startTime, double startValue, long endTime, double endValue) Constructor.Constructor.Line
(Coordinate start, Coordinate end) ConstructorLine
(Coordinate start, Coordinate end, PathInfo info) Constructor -
Method Summary
Modifier and TypeMethodDescriptionboolean
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
(Graphics2D gc, DrawContext ctx) Draws the line (this is called by the study framework).getColor()
Gets the color of the line.long
Gets the time of the ending location of the line.double
Gets the value of the ending location of the line.int
Gets the number of bars to extend past the start point.int
Gets the number of bars to extend past the end point.long
Gets the time of the starting location of the line.double
Gets the value of the starting location of the line.Gets the stroke for displaying the line.getText()
boolean
Returns true if the line should be extended to the left bounds of the plot.boolean
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
Sets the color of the line.void
setColorAbove
(double value, Color color) Use this method to change the color of the line when it is above a given value.void
setColorBelow
(double value, 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 pointvoid
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
Sets the stroke for displaying the line.void
Sets the text to be displayed in the center of the line.Methods inherited from class com.motivewave.platform.sdk.draw.Figure
getBounds, getPopupMessage, isUnderlay, setBounds, setPopupMessage, setUnderlay
-
Constructor Details
-
Line
Constructor- Parameters:
start
- starting location of the lineend
- ending location of the line
-
Line
Constructor- Parameters:
start
- starting location of the lineend
- ending location of the lineinfo
- describes how to display the line.
-
Line
public Line(long startTime, double startValue, long endTime, double endValue) Constructor.- Parameters:
startTime
-startValue
-endTime
-endValue
-
-
Line
Constructor.- Parameters:
startTime
-startValue
-endTime
-endValue
-info
-
-
-
Method Details
-
setStart
public void setStart(long time, double value) Sets the location of the start of the line.- Parameters:
time
- time (as milliseconds since 1970)value
- (y coordinate)
-
getStartTime
public long getStartTime()Gets the time of the starting location of the line.- Returns:
- start time for the line (milliseconds since 1970)
-
getStartValue
public double getStartValue()Gets the value of the starting location of the line.- Returns:
- start value for the line
-
setEnd
public void setEnd(long time, double value) Sets the location of the end of the line.- Parameters:
time
- time (as milliseconds since 1970)value
- (y coordinate)
-
getEndTime
public long getEndTime()Gets the time of the ending location of the line.- Returns:
- end time for the line (milliseconds since 1970)
-
getEndValue
public double getEndValue()Gets the value of the ending location of the line.- Returns:
- end value for the line
-
getText
- Returns:
- the text to be displayed in the center of the line.
-
setText
Sets the text to be displayed in the center of the line.- Parameters:
text
- text valuefont
- display font
-
getColor
Gets the color of the line.- Returns:
- the color of the line.
-
setColor
Sets the color of the line.- Parameters:
color
- line color
-
setStroke
Sets the stroke for displaying the line.- Parameters:
stroke
-
-
getStroke
Gets the stroke for displaying the line.- Returns:
- stroke used to display the line
-
setExtendLeft
public void setExtendLeft(int bars) Sets the number of bars to extend past the start point- Parameters:
bars
- number bars to extend to the left
-
getExtendLeft
public int getExtendLeft()Gets the number of bars to extend past the start point.- Returns:
- number of bars to extend left of the start point.
-
setExtendRight
public void setExtendRight(int bars) Sets the number of bars to extend past the end point.- Parameters:
bars
- number of bars to extend right
-
getExtendRight
public int getExtendRight()Gets the number of bars to extend past the end point.- Returns:
- number of bars to extend to the right of the end point.
-
setExtendRightBounds
public void setExtendRightBounds(boolean b) Extends the line to the right bounds of the plot. Note: this overrides the extend right (bars) property.- Parameters:
b
- true if the line should be extended to the right bounds of the plot.
-
isExtendRightBounds
public boolean isExtendRightBounds()Returns true if the line should be extended to the right bounds of the plot.- Returns:
- true if the line should be extended to the right bounds of the plot
-
setExtendLeftBounds
public void setExtendLeftBounds(boolean b) Extends the line to the left bounds of the plot. Note: this overrides the extend left (bars) property.- Parameters:
b
- true if the line should be extended to the left bounds of the plot.
-
isExtendLeftBounds
public boolean isExtendLeftBounds()Returns true if the line should be extended to the left bounds of the plot.- Returns:
- true if the line should be extended to the left bounds of the plot
-
setColorAbove
Use this method to change the color of the line when it is above a given value.- Parameters:
value
- value to color abovecolor
- color to use
-
setColorBelow
Use this method to change the color of the line when it is below a given value.- Parameters:
value
- value to color belowcolor
- color to use
-
isVisible
Returns true if the line is currently visible within the given draw context. -
contains
Returns true if the line contains the given x and y coordinates within the given draw context. -
layout
Lays out the line by converting the start and end coordinates to x,y coordinates on the graph. This is called by the study framework. -
draw
Draws the line (this is called by the study framework).
-