|
|||||||||
PREV CLASS NEXT CLASS | FRAMES NO FRAMES | ||||||||
SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD |
java.lang.Object org.corpstein.image.ChartStyle
public class ChartStyle
Encapsulates the style elements (colors, fonts, etc) needed to create a
chart using ChartFactory
.
Constructor Summary | |
---|---|
ChartStyle()
Sole constructor. |
Method Summary | |
---|---|
void |
addLayer(Layer layer)
|
java.awt.Paint |
getBarPaint(int column)
Returns the Paint of the bar for the specified column |
boolean |
getBorderEnabled()
Returns true if the chart border is enabled |
int |
getChartType()
Returns the chart type of the ChartStyle object |
int |
getImageHeight()
Returns the image height in pixels |
int |
getImageWidth()
Returns the image width in pixels |
java.awt.Font |
getKeyFont()
Returns the Font used for the chart key |
int |
getKeyFontMinimumSize()
Returns the minimum size allowed for the key font |
int |
getKeyType()
Returns the type of key used for the chart |
java.awt.Font |
getLabelFont()
Returns the Font used for the chart labels |
Layer |
getLayer(java.lang.String key)
Returns the layer with the given key |
java.util.Iterator |
getLayerIterator()
Returns an iterator of keys that can be used to loop through the layers |
java.awt.Paint |
getPaint(int attribute)
Returns the Paint of the specified attribute |
float[] |
getPaintValues(int attribute)
Returns an array of float containing the individual RGB values for the paint of the specified attribute |
int |
getPointMarkSize()
Returns the size of the point marks for the chart |
java.awt.Font |
getScaleFont()
Returns the Font used for the chart scale |
boolean |
getShowPointMarks()
Returns true if point marks are enabled for the chart |
java.awt.Font |
getTitleFont()
Returns the Font used for the chart title |
int |
getTitleFontMinimumSize()
Returns the minimum size allowed for the title font |
boolean |
getValueLabelsEnabled()
Returns true if value labels are enabled for the chart |
void |
prepareKey(ChartData data,
ChartMetrics metrics)
Validates the font to be used for the chart labels. |
void |
prepareKeyType(ChartData data)
Validates that the key type matches the chart data. |
void |
prepareLabelKey(ChartData data,
ChartMetrics metrics)
Validates the font to be used for the chart key. |
void |
prepareScale(java.lang.String label)
Validates the font to be used for the chart scale. |
void |
prepareStyle(ChartData data,
ChartMetrics metrics)
Prepares the title, key, and key type |
java.lang.String |
prepareTitle(java.lang.String oldTitle)
Validates the font to be used for the chart title. |
void |
setBarPaint(int column,
java.awt.Paint paint)
Sets the bar Paint for the specific column. |
void |
setBarPaint(java.awt.Paint paint)
Sets the bar paint for all columns. |
void |
setBorderEnabled(boolean isBorderEnabled)
Sets the border enabled attribute for the chart |
void |
setChartType(int type)
Sets the chart type to the specified type |
void |
setKeyFont(java.awt.Font font)
Sets the key font to the specified Font |
void |
setKeyFontMinimumSize(int size)
Sets the minimum font size for chart keys |
void |
setKeyType(int keyType)
Sets the key type to one of KEY_TYPE_BAR_COLOR_ASSOCIATION ,
KEY_TYPE_DIAGONAL_BAR_LABELS , or
KEY_TYPE_HORIZONTAL_BAR_LABELS |
void |
setLabelFont(java.awt.Font font)
Sets the Font to use for chart labels |
void |
setPaint(int attribute,
java.awt.Paint paint)
Sets the specified attribute to the paint parameter. |
void |
setPointMarkSize(int pointMarkSize)
Sets the size of the chart point marks |
void |
setScaleFont(java.awt.Font font)
Sets the Font to use for the chart scale |
void |
setShowPointMarks(boolean showPointMarks)
Sets whether to show point marks in line charts |
void |
setTitleFont(java.awt.Font font)
Sets the Font to use for the chart title |
void |
setTitleFontMinimumSize(int size)
Sets the minimum size to use for the title font |
void |
setValueLabelsEnabled(boolean isValueLabelsEnabled)
Sets whether to enable value labels |
java.lang.String |
toString()
Creates and returns a String describing all of the contents of the ChartStyle object for debugging use |
Methods inherited from class java.lang.Object |
---|
clone, equals, finalize, getClass, hashCode, notify, notifyAll, wait, wait, wait |
Field Detail |
---|
public static final int CHART_TYPE_BAR
public static final int CHART_TYPE_LINE
public static final int CHART_TYPE_PIE
public static final int DEFAULT_CHART_TYPE
public static final boolean DEFAULT_SHOW_POINT_MARKS
public static final int DEFAULT_POINT_MARK_SIZE
public static final int COLOR_LABEL
public static final int COLOR_SHADOW
public static final int COLOR_BACKGROUND
public static final int COLOR_WALL
public static final int COLOR_EDGE
public static final int MAX_COLUMNS
public static final int MAX_LINES
public static final int MAX_BARS
public static final java.lang.String DEFAULT_KEY_FONT_NAME
public static final int DEFAULT_KEY_FONT_SIZE
public static final int DEFAULT_KEY_FONT_STYLE
public static final java.awt.Font DEFAULT_KEY_FONT
public static final java.lang.String DEFAULT_LABEL_FONT_NAME
public static final int DEFAULT_LABEL_FONT_SIZE
public static final int DEFAULT_LABEL_FONT_STYLE
public static final java.awt.Font DEFAULT_LABEL_FONT
public static final java.lang.String DEFAULT_SCALE_FONT_NAME
public static final int DEFAULT_SCALE_FONT_SIZE
public static final int DEFAULT_SCALE_FONT_STYLE
public static final java.awt.Font DEFAULT_SCALE_FONT
public static final java.lang.String DEFAULT_TITLE_FONT_NAME
public static final int DEFAULT_TITLE_FONT_SIZE
public static final int DEFAULT_TITLE_FONT_STYLE
public static final java.awt.Font DEFAULT_TITLE_FONT
public static final int DEFAULT_KEY_FONT_MINIMUM_SIZE
public static final int DEFAULT_SCALE_FONT_MINIMUM_SIZE
public static final int DEFAULT_TITLE_FONT_MINIMUM_SIZE
public static final float MINIMUM_LABEL_ALPHA
public static final int KEY_TYPE_BAR_COLOR_ASSOCIATION
public static final int KEY_TYPE_DIAGONAL_BAR_LABELS
public static final int KEY_TYPE_HORIZONTAL_BAR_LABELS
public static final int DEFAULT_KEY_TYPE
Constructor Detail |
---|
public ChartStyle()
Method Detail |
---|
public void addLayer(Layer layer)
public java.awt.Paint getBarPaint(int column)
column
- The column of the bar in question
java.lang.IllegalArgumentException
- if the column value is out of boundspublic boolean getBorderEnabled()
true
if the chart border is enabled
public java.awt.Paint getPaint(int attribute)
attribute
- The attribute in question
java.lang.IllegalArgumentException
- if the attribute parameter is out of
boundspublic float[] getPaintValues(int attribute)
attribute
- The attribute in question
java.lang.IllegalArgumentException
- if attribute value is out of boundspublic int getChartType()
public int getImageHeight()
public int getImageWidth()
public java.awt.Font getKeyFont()
public int getKeyFontMinimumSize()
public int getKeyType()
public Layer getLayer(java.lang.String key)
public java.util.Iterator getLayerIterator()
public java.awt.Font getLabelFont()
public int getPointMarkSize()
public java.awt.Font getScaleFont()
public boolean getShowPointMarks()
true
if point marks are enabled for the chart
public java.awt.Font getTitleFont()
public int getTitleFontMinimumSize()
public boolean getValueLabelsEnabled()
true
if value labels are enabled for the chart
public void prepareKey(ChartData data, ChartMetrics metrics)
data
- The ChartData object that contains the label valuesmetrics
- The ChartMetrics object that contains the max label widthpublic void prepareLabelKey(ChartData data, ChartMetrics metrics)
data
- The ChartData object that contains the label valuesmetrics
- The ChartMetrics object that contains the max label widthpublic void prepareKeyType(ChartData data)
data
- The ChartData object that contains the total values per
column
java.lang.IllegalStateException
- if the key type does not match the chart
datapublic void prepareScale(java.lang.String label)
public void prepareStyle(ChartData data, ChartMetrics metrics)
data
- The ChartData object that contains the data for the chartmetrics
- The ChartMetrics object that contains the metrics for
the chartpublic java.lang.String prepareTitle(java.lang.String oldTitle)
oldTitle
- The title for the chartpublic void setBarPaint(int column, java.awt.Paint paint)
column
- The column in questionpaint
- The paint to use
java.lang.IllegalArgumentException
- if the specified paint is null or
the column parameter is out of boundspublic void setBarPaint(java.awt.Paint paint)
paint
- The Paint to use
java.lang.IllegalArgumentException
- if the paint parameter is nullpublic void setBorderEnabled(boolean isBorderEnabled)
isBorderEnabled
- The new value for the border enabled attributepublic void setPaint(int attribute, java.awt.Paint paint)
attribute
- The attribute in questionpaint
- The Paint to use
java.lang.IllegalArgumentException
- if the paint parameter is null or
if the attribute is out of rangepublic void setChartType(int type)
type
- The chart type to use
java.lang.IllegalArgumentException
- if the chart type is out of boundspublic void setKeyFont(java.awt.Font font)
font
- The Font to use
java.lang.IllegalArgumentException
- if the specified font is nullpublic void setKeyFontMinimumSize(int size)
size
- The size to use
java.lang.IllegalArgumentException
- if the size is less than 1public void setKeyType(int keyType)
KEY_TYPE_BAR_COLOR_ASSOCIATION
,
KEY_TYPE_DIAGONAL_BAR_LABELS
, or
KEY_TYPE_HORIZONTAL_BAR_LABELS
keyType
- The key type to use
java.lang.IllegalArgumentException
- if the key type is invalidpublic void setLabelFont(java.awt.Font font)
font
- The Font to use
java.lang.IllegalArgumentException
- if the font is nullpublic void setPointMarkSize(int pointMarkSize)
pointMarkSize
- The size to use
java.lang.IllegalArgumentException
- if the size is less than 1public void setScaleFont(java.awt.Font font)
font
- The Font to use
java.lang.IllegalArgumentException
- if the font is nullpublic void setTitleFont(java.awt.Font font)
font
- The Font to use
java.lang.IllegalArgumentException
- if the font is nullpublic void setShowPointMarks(boolean showPointMarks)
showPointMarks
- the value to usepublic void setTitleFontMinimumSize(int size)
size
- The size to use
java.lang.IllegalArgumentException
- if the size is less than 1public void setValueLabelsEnabled(boolean isValueLabelsEnabled)
isValueLabelsEnabled
- The value to usepublic java.lang.String toString()
toString
in class java.lang.Object
|
|||||||||
PREV CLASS NEXT CLASS | FRAMES NO FRAMES | ||||||||
SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD |