|
| Components |
|
| |||||||||||
| PREV CLASS NEXT CLASS | FRAMES NO FRAMES | |||||||||||||
| SUMMARY: INNER | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD | |||||||||||||
java.lang.Object
|
+--com.sas.Component
|
+--com.sas.graphics.chart.AxisStyle
The AxisStyle class encapsulates visual attributes of an axis in a chart.
The type, color, grid style, value style, and label style of the axis are
defined by the AxisStyle class. Different axes in a chart may share a single
AxisStyle object.
Creating an AxisStyle Object
A valid instance is created by instantiating an object of AxisStyle either using the default constructor or by instantiating a hard copy of a pre-existing AxisStyle object.
// Default Constructor
AxisStyle axisStyle = new AxisStyle();
// Hard copy of an existing AxisStyle Object
AxisStyle axisStyle = new AxisStyle(AxisStyle oldStyle);
Setting up the type of the axis
The axis can be of various types. By default the axis type is AxisTypes.LINE. It can be modified by using
the setAxisType() method. To turn off the axis, you can use
axisStyle.setAxisType(AxisTypes.NONE);
Setting up the color of the axis
The axis color can be set by using the setColor() method. By default the color is black.
Tickmarks also use this color.
axisStyle.setAxisColor(java.awt.Color.red);
Setting up the grid style
Each axis in a chart has a gridStyle property associated with it.
The grid can be turned on and off by using the setVisible() method of the grid style object.
The color of the grid can also be modified. It is black by default.
// Turn on the grid and set its color to white.
GridStyle grid = axisStyle.getGridStyle();
grid.setVisible(true);
grid.setColor(java.awt.Color.white);
Setting up the label style
The labelStyle property defines the visual attributes for the axis label, such as color, font family,
font size, font style (plain, bold, italic), and maximum number of characters which may be displayed.
It is an instance of the TextStyle class. The following code will set the color to blue,
font size to 12 point, font style to bold, and maxChars to 15:
TextStyle style = axisStyle.getLabelStyle();
style.setColor(java.awt.Color.blue);
style.setSize(12.0);
style.setBold(true);
style.setMaxChars(15);
Hiding the label of the axis
The label of the axis can be hidden using the setHideLabel() method. By default the color is black and the
label is visible.
axisStyle.setHideLabel(true);
Setting up the value style
The valueStyle property defines visual attributes for the tickmark values.
The following code will set the color to green and maxChars to 10:
TextStyle style = axisStyle.getValueStyle();
style.setColor(java.awt.Color.green);
style.setMaxChars(10);
Setting up the number of rows for displaying tickmark values
You can set up the axis to display the tickmark values in one row or two rows. By default it
will automatically adjust the number of rows based on the space available for tickmarks.
The following code will force the chart to display tickmark values on the axis in one row:
style.setNumRows(RowNumberTypes.ONE);
Setting up the number of the intervals
You can set up the axis to have a fixed number of intervals. By default, the number
of intervals are based on the range of the data and it tries to divide
the range into clean values for the tick values.
The following code will force the chart to have 10 intervals:
style.setFixedIntervals(true);
style.setIntervals(10);
Setting up the data range
You can set up the minimum and maximum values to be used by the axis. By default,
these values are picked dynamically from the data set.
The following code will force the data range to be from 0.0 to 10.0:
style.setMinDataValue(0.0);
style.setMaxDataValue(10.0);
| Name | labelStyle |
| Type | TextStyle |
| Default value | a TextStyle object |
| Short description | Label's TextStyle |
| Description | TextStyle used to draw axis label. |
| Name | hideLabel |
| Type | boolean |
| Default value | false |
| Short description | Hide axis label. |
| Description | Axis label is set to hide or visible. |
| Name | valueStyle |
| Type | TextStyle |
| Default value | a TextStyle object |
| Short description | Values' TextStyle |
| Description | TextStyle used to draw axis (tickmark) values. |
| Name | gridStyle |
| Type | GridStyle |
| Default value | a GridStyle object |
| Short description | Grid's GridStyle |
| Description | GridStyle used to draw axis grid. |
| Name | axisType |
| Type | AxisTypes |
| Default value | AxisTypes.LINE |
| Short description | Axis type |
| Description | Type of axis. |
| Name | axisColor |
| Type | Color |
| Default value | Color.black |
| Short description | Axis color. |
| Description | Color used to draw the axis. |
| Name | numRows |
| Type | RowNumberTypes |
| Default value | RowNumberTypes.AUTOMATIC |
| Short description | Number of rows to display tickmark values. |
| Description | Number of rows to display tickmark values. |
| Name | minDataValue |
| Type | double |
| Default value | Minimum value from the data |
| Short description | Minimum Value. |
| Description | Minimum value for the data range to be used. |
| Name | maxDataValue |
| Type | double |
| Default value | Maximum value from the data |
| Short description | Maximum Value. |
| Description | Maximum value for the data range to be used. |
| Name | fixedIntervals |
| Type | boolean |
| Default value | false |
| Short description | Fixed intervals. |
| Description | Number of intervals are fixed or dynamic. |
| Name | intervals |
| Type | int |
| Default value | 10 |
| Short description | Number of intervals. |
| Description | Number of intervals if fixedIntervals attribute is set to true. |
| Field Summary | |
protected AxisStyle |
axisStyle
Deprecated. |
static String |
RB_KEY
Deprecated. |
| Constructor Summary | |
AxisStyle()
Deprecated. Default constructor. |
|
AxisStyle(AxisStyle styleIn)
Deprecated. Create a hard copy of the input instance. |
|
| Method Summary | |
boolean |
equals(Object obj)
Deprecated. |
Color |
getAxisColor()
Deprecated. Return the java Color for the axis. |
com.sas.graphics.chart.AxisTypes |
getAxisType()
Deprecated. Return the type of the axis. |
double |
getDataMaxValue()
Deprecated. Return the maximum value in the data range set by the user. |
double |
getDataMinValue()
Deprecated. Return the minimum value in the data range set by the user. |
static ExtendedBeanInfo |
getExtendedBeanInfo()
Deprecated. |
GridStyle |
getGridStyle()
Deprecated. Return the GridStyle object used for the axis grid. |
int |
getIntervals()
Deprecated. Return the number of intervals for axis labelling. |
TextStyle |
getLabelStyle()
Deprecated. Return the TextStyle object used for the label in the axis. |
com.sas.graphics.chart.RowNumberTypes |
getNumRows()
Deprecated. Return the number of the rows used to display tickmark values. |
TextStyle |
getValueStyle()
Deprecated. Return the TextStyle object used for the tickmark values in the axis. |
boolean |
isFixedDataRange()
Deprecated. Return true if the data range of the (numeric) axis is set by the user. |
boolean |
isFixedIntervals()
Deprecated. Return true if the number of intervals for axis labelling is set by the user. |
boolean |
isHideLabel()
Deprecated. Return the visibility of the label. |
boolean |
isValuesVisible()
Deprecated. Return the visibility of the values. |
void |
propertyChange(PropertyChangeEvent pce)
Deprecated. |
void |
setAxisColor(Color color)
Deprecated. Set the java color for the axis including tickmarks. |
void |
setAxisType(com.sas.graphics.chart.AxisTypes type)
Deprecated. Set the type of the axis. |
void |
setDataMaxValue(double max)
Deprecated. Set the maximum value in the data range for axis labelling. |
void |
setDataMinValue(double min)
Deprecated. Set the minimum value in the data range for axis labelling. |
void |
setFixedDataRange(boolean fixed)
Deprecated. Set true if the data range of the (numeric) axis is set by the user. |
void |
setFixedIntervals(boolean fixed)
Deprecated. Set true if the number of intervals for axis labelling is set by the user. |
void |
setGridStyle(GridStyle gs)
Deprecated. Set the GridStyle object used for the axis grid. |
void |
setHideLabel(boolean hide)
Deprecated. Set the visibility of the label. |
void |
setIntervals(int count)
Deprecated. Set the number of intervals for axis labelling. |
void |
setLabelStyle(TextStyle ts)
Deprecated. Set the TextStyle object used for the label in the axis. |
void |
setNumRows(com.sas.graphics.chart.RowNumberTypes num)
Deprecated. Set the number of the rows used to display values. |
void |
setValueStyle(TextStyle ts)
Deprecated. Set the TextStyle object used for the values in the axis. |
void |
setValuesVisible(boolean hide)
Deprecated. Set the visibility of the values. |
| Methods inherited from class com.sas.Component |
addLink, addPropertyChangeListener, addVetoableChangeListener, anyPropertyChangeListeners, attachModel, attachView, beansIsDesignTime, beansSetDesignTime, clone, clone, detachModel, detachView, dumpComponent, firePropertyChange, firePropertyChange, fireVetoableChange, getComponentDescription, getComponentSupportInfo, getEventMethod, getEventValues, getLinkInfo, getModelInterface, getRequiredInterfaces, getResources, getStringResource, getViewInterfaceSupportInfo, initialize, initializeComponent, isDesignTime, isLinked, queryLinks, queryLinks, refresh, removeAllLinks, removeInterfaceTraps, removeLink, removePropertyChangeListener, removeVetoableChangeListener, setComponentDescription, setComponentSupportInfo, setDefaultValues, setLinkInfo, setModelInterface, setRequiredInterfaces, setViewInterfaceSupportInfo, supportsListenerInterface, supportsRequiredInterfaces, trapInterfaceEvents, validateObject |
| Methods inherited from class java.lang.Object |
finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait |
| Field Detail |
public static final String RB_KEY
protected AxisStyle axisStyle
| Constructor Detail |
public AxisStyle()
public AxisStyle(AxisStyle styleIn)
| Method Detail |
public static ExtendedBeanInfo getExtendedBeanInfo()
public void propertyChange(PropertyChangeEvent pce)
propertyChange in class com.sas.Componentpublic TextStyle getLabelStyle()
setLabelStyle(com.sas.graphics.chart.TextStyle)public void setLabelStyle(TextStyle ts)
ts - text style for the axis labelgetLabelStyle()public TextStyle getValueStyle()
setValueStyle(com.sas.graphics.chart.TextStyle)public void setValueStyle(TextStyle ts)
ts - text style object for the axis valuesgetValueStyle()public GridStyle getGridStyle()
getGridStyle()public void setGridStyle(GridStyle gs)
gs - style for the axis gridgetGridStyle()public com.sas.graphics.chart.AxisTypes getAxisType()
setAxisType(com.sas.graphics.chart.AxisTypes)public void setAxisType(com.sas.graphics.chart.AxisTypes type)
type - axis typegetAxisType()public Color getAxisColor()
setAxisColor(java.awt.Color)public void setAxisColor(Color color)
color - axis colorgetAxisColor()public com.sas.graphics.chart.RowNumberTypes getNumRows()
setNumRows(com.sas.graphics.chart.RowNumberTypes)public void setNumRows(com.sas.graphics.chart.RowNumberTypes num)
num - how many rows should the values be displayedgetNumRows()public boolean isFixedDataRange()
setFixedDataRange(boolean)public void setFixedDataRange(boolean fixed)
fixed - true if the data range of the (numeric) axis is set by the userisFixedDataRange()public double getDataMinValue()
setDataMinValue(double)public void setDataMinValue(double min)
min - the minimum value in the data rangegetDataMinValue()public double getDataMaxValue()
setDataMaxValue(double)public void setDataMaxValue(double max)
max - the maximum value in the data rangegetDataMaxValue()public int getIntervals()
setIntervals(int)public void setIntervals(int count)
count - the number of intervalsgetIntervals()public boolean isFixedIntervals()
setFixedIntervals(boolean)public void setFixedIntervals(boolean fixed)
fixed - true if the number of intervals for axis labelling is set by the userisFixedIntervals()public boolean isHideLabel()
setHideLabel(boolean)public void setHideLabel(boolean hide)
visible - true if visibleisHideLabel()public boolean isValuesVisible()
setHideLabel(boolean)public void setValuesVisible(boolean hide)
visible - true if visibleisValuesVisible()public boolean equals(Object obj)
equals in class Object
|
| Components |
|
| |||||||||||
| PREV CLASS NEXT CLASS | FRAMES NO FRAMES | |||||||||||||
| SUMMARY: INNER | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD | |||||||||||||