|
||||||||
PREV CLASS NEXT CLASS | FRAMES NO FRAMES | |||||||
SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD |
java.lang.Object com.objectplanet.chart.Grid
public class Grid
This class represents the chart grid with all ranges and lables.
Field Summary | |
---|---|
static int |
HORIZONTAL
Horizontal bar alignment. |
static int |
TARGET_LINE_ID_AND_VALUE_LABEL
Use both the ID and value label with the target lines; setTargetValueLine(). |
static int |
TARGET_LINE_ID_LABEL
Use the ID label with the target lines; setTargetValueLine(). |
static int |
TARGET_LINE_NO_LABEL
Use no label with the target lines; setTargetValueLine(). |
static int |
TARGET_LINE_VALUE_LABEL
Use the value label with the target lines; setTargetValueLine(). |
static int |
VERTICAL
Vertical bar alignment. |
Constructor Summary | |
---|---|
Grid(GenericChart chart)
Creates the chart grid. |
Method Summary | |
---|---|
java.lang.String |
formatRangeNumber(int index,
double value)
Formats a floating number to the number of decimals given for the specified range. |
double |
getCurrentLowerRange(int range)
Gets the current lower range of the specified range. |
double |
getCurrentRange(int range)
Gets the current upper range of the specified range. |
java.awt.Insets |
getGraphInsets()
Gets the graph insets. |
int |
getGridAlignment()
Gets the bar alignment. |
double |
getGridLine(int index)
Gets grid lines positon value by its index. |
java.awt.Color |
getGridLineColor(int index)
Gets grid line's color value by it's index. |
java.awt.Color[] |
getGridLineColors()
Gets the vertical grid lines colors. |
double[] |
getGridLines()
Gets the vertical grid lines positons. |
double |
getLowerRange(int index)
Gets the lower value of the specified range. |
int |
getMaxValueLineCount()
Gets the current maxium number of value lines set. |
double |
getRange(int index)
Gets the upper value of the specified range. |
int |
getRangeAdjusted(int adjuster)
Gets the range(s) adjusted by the specified adjuster. |
int |
getRangeAdjusterPosition()
Gets the position of the first range adjuster. |
java.awt.Color |
getRangeColor(int index)
Gets the color of the specified range. |
int |
getRangeCount()
Gets number of ranges used in the grid. |
int |
getRangeDecimalCount(int index)
Gets the number of decimals used in the range values. |
java.text.NumberFormat |
getRangeFormatter(int index)
Get the number formatter of this range. |
double |
getRangeInterval(int range)
Gets the interval between the ticks on the specified range. |
int |
getRangePosition(int index)
Gets the range position. |
int |
getTargetLabelsPosition()
Gets the target labels position |
double |
getTargetValueLine(java.lang.String id)
Gets the value of a target value line. |
java.awt.Color |
getValueLinesColor()
Gets the color of the value lines. |
boolean |
isDefaultGridLinesOn()
Checks if the default vertical grid lines are on. |
boolean |
isGridAdjustmentOn(int edge)
Checks if runtime grid adjustment is on. |
boolean |
isRangeAdjusterOn(int adjuster)
Checks if the specified range adjuster is turned on. |
boolean |
isRangeLabelsOn(int index)
Checks if the range labels are on or off. |
boolean |
isRangeOn(int index)
Checks if the specified range is on. |
boolean |
isRightToLeftScrollingOn()
Checks if the right to left scrolling is turned on. |
boolean |
isSampleScrollerOn()
Checks if the sample scroller is turned on. |
boolean |
isValueLinesOn()
Checks if the value lines are turned on. |
void |
reset()
Resets the chart data and features. |
void |
setCurrentLowerRange(int range,
double lower)
Sets the current lower range of the specified range. |
void |
setCurrentRange(int range,
double upper)
Sets the current upper range of the specified range. |
void |
setDefaultGridLinesColor(java.awt.Color color)
Sets the color of the default vertical grid lines. |
void |
setDefaultGridLinesOn(boolean on)
Turns on or off the default vertical grid lines. |
void |
setDefaultGridLinesOn(boolean on,
double start,
double step)
Turns on or off the default vertical grid lines. |
void |
setGraphInsets(int top,
int left,
int bottom,
int right)
Sets the insets between the graph itself and the chart component edges. |
void |
setGridAdjustmentOn(int edge,
boolean on)
Turns on or of runtime grid adjustment. |
void |
setGridAlignment(int alignment)
Sets the bar alignment. |
void |
setGridLine(int index,
double value)
Sets a single grid line value. |
void |
setGridLineColor(int index,
java.awt.Color color)
Sets a single grid line color. |
void |
setGridLineColors(java.awt.Color[] colors)
Sets the color of each vertical grid line. |
void |
setGridLines(double[] lines)
Sets the vertical grid lines positons. |
void |
setGridLinesColor(java.awt.Color color)
Sets the vertical grid lines color. |
void |
setLowerRange(int index,
double range)
Sets the lower range of the chart. |
void |
setLowerRelativeRange(double range)
Sets the lower range of the chart relative to the current minimum value. |
void |
setLowerRelativeRange(double range,
double step)
Sets the lower range of the chart relative to the minimum value of the bars in the chart. |
void |
setLowerRelativeRange(int index,
double range,
double step)
Sets the lower range of the chart relative to the minimum value of the bars in the chart. |
void |
setMaxValueLineCount(int count)
Sets the maximum number of value lines there should be in the chart. |
void |
setRange(int index,
double range)
Sets the upper value of the specified range. |
void |
setRangeAdjusted(int adjuster,
int range)
Sets which range(s) to be adjusted by the specified adjuster. |
void |
setRangeAdjusterOn(int adjuster,
boolean on)
Turns on or off the range adjuster. |
void |
setRangeAdjusterPosition(int position)
Sets the position of the first range adjuster. |
void |
setRangeColor(int index,
java.awt.Color color)
Sets the color of the specified range. |
void |
setRangeDecimalCount(int index,
int count)
Sets the number of decimals to use in the range label values. |
void |
setRangeFormatter(int index,
java.text.NumberFormat formatter)
Sets a number formatter for the specific range. |
void |
setRangeInterval(int range,
double interval)
Sets interval between the ticks on the specified range. |
void |
setRangeLabelsOn(int index,
boolean on)
Turns on or off the range value labels for specified range. |
void |
setRangeOn(int index,
boolean on)
Turns on or off the specified range. |
void |
setRangePosition(int index,
int position)
Sets the range position. |
void |
setRelativeRange(double range)
Sets the upper range of the chart relative to the maximum value of the bars in the chart. |
void |
setRelativeRange(double range,
double step)
Sets the upper range of the chart relative to the maximum value of the bars in the chart. |
void |
setRelativeRange(int index,
double range,
double step)
Sets the upper range of the chart relative to the maximum value of the bars in the chart. |
void |
setRightToLeftScrollingOn(boolean state)
Turns on right to left scrolling when adding new values. |
void |
setSampleAxisRange(double min,
double max)
Sets the left and the right range of the chart. |
void |
setSampleScrollerOn(boolean on)
Turns on or off the sample scroller. |
void |
setTargetLabelsPosition(int position)
Sets the target labels position. |
void |
setTargetValueLine(java.lang.String id,
double value,
java.awt.Color color,
int style,
int range)
Sets a target value line with the specified ID, value, and color. |
void |
setValueLinesColor(java.awt.Color color)
Sets the color of the value lines in the chart. |
void |
setValueLinesOn(boolean on)
Turns on or off the chart value lines. |
Methods inherited from class java.lang.Object |
---|
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait |
Field Detail |
---|
public static final int HORIZONTAL
public static final int TARGET_LINE_ID_AND_VALUE_LABEL
public static final int TARGET_LINE_ID_LABEL
public static final int TARGET_LINE_NO_LABEL
public static final int TARGET_LINE_VALUE_LABEL
public static final int VERTICAL
Constructor Detail |
---|
public Grid(GenericChart chart)
Method Detail |
---|
public java.lang.String formatRangeNumber(int index, double value)
index
- The range index.value
- The value to format.
public double getCurrentLowerRange(int range)
range
- The index of the range.setCurrentLowerRange(int, double)
public double getCurrentRange(int range)
range
- The index of the rangesetCurrentRange(int, double)
public java.awt.Insets getGraphInsets()
setGraphInsets(int, int, int, int)
public int getGridAlignment()
setGridAlignment(int)
public double getGridLine(int index)
index
- The index of the line to get value from.
public java.awt.Color getGridLineColor(int index)
index
- The index of the line to get color from.
public java.awt.Color[] getGridLineColors()
public double[] getGridLines()
public double getLowerRange(int index)
index
- The index of the range.public int getMaxValueLineCount()
setMaxValueLineCount(int)
public double getRange(int index)
index
- The index of the range (0 or 1).public int getRangeAdjusted(int adjuster)
adjuster
- The index of the adjuster.
public int getRangeAdjusterPosition()
public java.awt.Color getRangeColor(int index)
index
- The index of the range (0 or 1).public int getRangeCount()
public int getRangeDecimalCount(int index)
index
- The index of the range (0 or 1).public java.text.NumberFormat getRangeFormatter(int index)
index
- The index of the range.
public double getRangeInterval(int range)
range
- The index of the range.
public int getRangePosition(int index)
index
- The index of the range (0 or 1).
public int getTargetLabelsPosition()
public double getTargetValueLine(java.lang.String id)
id
- The id of the target line.
public java.awt.Color getValueLinesColor()
public boolean isDefaultGridLinesOn()
public boolean isGridAdjustmentOn(int edge)
edge
- TOP, LEFT, BOTTOM, or RIGHT.
public boolean isRangeAdjusterOn(int adjuster)
adjuster
- The index of the adjuster (0 or 1)
public boolean isRangeLabelsOn(int index)
index
- The index of the range to check for.
public boolean isRangeOn(int index)
index
- The index of the range (0 or 1).
public boolean isRightToLeftScrollingOn()
setRightToLeftScrollingOn(boolean)
public boolean isSampleScrollerOn()
public boolean isValueLinesOn()
public void reset()
public void setCurrentLowerRange(int range, double lower)
range
- The index of the range .lower
- The range to use, larger or equal to the lower range.public void setCurrentRange(int range, double upper)
range
- The index of the rangeupper
- The range to use, less or equal to the full range.public void setDefaultGridLinesColor(java.awt.Color color)
color
- The color to set for default grid lines.public void setDefaultGridLinesOn(boolean on)
on
- True for on, false for off.setGridLines(double[])
public void setDefaultGridLinesOn(boolean on, double start, double step)
on
- True for on, false for off.start
- Position of the first line.step
- Distance between lines.setGridLines(double[])
public void setGraphInsets(int top, int left, int bottom, int right)
top
- The top insets in pixels.left
- The left insets in pixels.bottom
- The bottom insets in pixels.right
- The right insets in pixels.public void setGridAdjustmentOn(int edge, boolean on)
edge
- TOP,LEFT,BOTTOM, or RIGHT.on
- True or on, false for off.public void setGridAlignment(int alignment)
alignment
- HORIZONTAL or VERTICAL.
java.lang.IllegalArgumentException
- If the alignment is not valid.public void setGridLine(int index, double value)
index
- The index of the line to set value for.value
- The value to set.
java.lang.IllegalArgumentException
- if the index is invalid.public void setGridLineColor(int index, java.awt.Color color)
index
- The index of the line to set Color for.color
- The color to set for the grid line.
java.lang.IllegalArgumentException
- if the index is invalid.public void setGridLineColors(java.awt.Color[] colors)
colors
- The array with grid lines colors.public void setGridLines(double[] lines)
lines
- The array with grid lines position values.setSampleAxisRange(double, double)
public void setGridLinesColor(java.awt.Color color)
color
- The color to set for all lines.public void setLowerRange(int index, double range)
index
- The index of the range to set (0 or 1).range
- The range to set.setRange(int, double)
public void setLowerRelativeRange(double range)
range
- The relative range;setLowerRelativeRange(double)
public void setLowerRelativeRange(double range, double step)
range
- The relative range (0.0->);step
- The range will be divisible by this value.setLowerRelativeRange(double)
public void setLowerRelativeRange(int index, double range, double step)
index
- The index of the range (0 or 1).range
- The relative range (0.0->);step
- The range will be divisible by this value.setLowerRelativeRange(double)
public void setMaxValueLineCount(int count)
count
- The value line count.public void setRange(int index, double range)
index
- The index of the range to set (0 or 1).range
- The range to set.setLowerRange(int, double)
public void setRangeAdjusted(int adjuster, int range)
adjuster
- The index of the adjuster (0 or 1).range
- The range to be adjusted. -1 = all ranges.public void setRangeAdjusterOn(int adjuster, boolean on)
adjuster
- The index of the adjuster (0 or 1)on
- True for on, false for off.public void setRangeAdjusterPosition(int position)
position
- 0 for left, 1 for right.public void setRangeColor(int index, java.awt.Color color)
index
- The index of the range (0 or 1).color
- The color to use for the range.public void setRangeDecimalCount(int index, int count)
index
- The index of the range (0 or 1).count
- The number of decimals to use.public void setRangeFormatter(int index, java.text.NumberFormat formatter)
index
- The index of the range.formatter
- The number formatter to set.public void setRangeInterval(int range, double interval)
range
- The index of the range.interval
- The interval between the to range ticks.public void setRangeLabelsOn(int index, boolean on)
index
- The index of the range to turn on/off the labels for.
If index == -1, the property is set for all ranges.on
- True for on, false for off.public void setRangeOn(int index, boolean on)
index
- The index of the range (0 or 1).on
- True for on, false of off.public void setRangePosition(int index, int position)
index
- The index of the range (0 or 1).position
- 0 for left, 1 for rightpublic void setRelativeRange(double range)
range
- The relative range (0.0->);setRelativeRange(double, double)
public void setRelativeRange(double range, double step)
range
- The relative range (0.0->);step
- The range will be divisible by this value.setRelativeRange(double)
public void setRelativeRange(int index, double range, double step)
index
- The index of the range to set (0 or 1).range
- The relative range (0.0->);step
- The range will be divisible by this value.setRelativeRange(double)
public void setRightToLeftScrollingOn(boolean state)
state
- True for on, false for off. Default is off.public void setSampleAxisRange(double min, double max)
min
- The left rangemax
- The right range
java.lang.IllegalArgumentException
- if min more or equal than max.public void setSampleScrollerOn(boolean on)
on
- True for on, false for off.public void setTargetLabelsPosition(int position)
position
- 0 for left, 1 for right, -1 - the target labels
will be displayed on the same side as the range with index 0.public void setTargetValueLine(java.lang.String id, double value, java.awt.Color color, int style, int range)
id
- The id of the target line.value
- The value where the line should appear.color
- The color of the line, if null, the line is removed.style
- TARGET_LINE_NO_LABEL, TARGET_LINE_ID_LABEL,
TARGET_LINE_VALUE_LABEL, or TARGET_LINE_ID_AND_VALUE_LABEL.range
- The range where the label will appear, and the value line is related to.
java.lang.IllegalArgumentException
- if the style is invalid.public void setValueLinesColor(java.awt.Color color)
color
- The color to use.public void setValueLinesOn(boolean on)
on
- True for on, false for off.setMaxValueLineCount(int)
|
||||||||
PREV CLASS NEXT CLASS | FRAMES NO FRAMES | |||||||
SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD |