Package com.motivewave.platform.sdk.draw
Class ColorRange
java.lang.Object
com.motivewave.platform.sdk.draw.Figure
com.motivewave.platform.sdk.draw.ColorRange
This class may be used to draw a set of colors at a given bar location.
Each color is defined by a region. The region consists of a color plus top and bottom values.
The width of the color range will be the bar width of the graph.
A background color may be specified to fill areas where no color has been defined.
-
Constructor Summary
-
Method Summary
Modifier and TypeMethodDescriptionvoid
Adds a color region to this range.void
Removes all of the regions defined for this color range.void
draw
(Graphics2D gc, DrawContext ctx) This method draws the figure on the graph (using the given Graphics2D).Gets the background color for the color range.long
getTime()
Gets the time (in milliseconds since 1970) where this bar is displayed.void
layout
(DrawContext ctx) Converts the color regions to displayable areas on the graph.void
Sets the background color for the color range.Methods inherited from class com.motivewave.platform.sdk.draw.Figure
contains, getBounds, getPopupMessage, isUnderlay, isVisible, setBounds, setPopupMessage, setUnderlay
-
Constructor Details
-
ColorRange
public ColorRange(long time) Creates a color range at the given bar time.- Parameters:
time
- milliseconds since 1970
-
-
Method Details
-
layout
Converts the color regions to displayable areas on the graph. -
draw
This method draws the figure on the graph (using the given Graphics2D). This method is called by the study framework to display the figure on the graph. -
addRegion
Adds a color region to this range. The top and bottom values are 'real' values and will be converted to graph values in the 'layout' method.- Parameters:
color
- Color for the regionbottom
- 'real' bottom valuetop
- 'real' top value
-
clearRegions
public void clearRegions()Removes all of the regions defined for this color range. -
setBackgroundColor
Sets the background color for the color range. this is the color that is shown for undefined regions.- Parameters:
bg
- background color
-
getBackgroundColor
Gets the background color for the color range. this is the color that is shown for undefined regions.- Returns:
- background color for the color range.
-
getTime
public long getTime()Gets the time (in milliseconds since 1970) where this bar is displayed.- Returns:
- time where this bar is displayed
-