Package com.inet.report.chart.plot
Class AbstractPlot
- java.lang.Object
-
- com.inet.report.chart.plot.AbstractPlot
-
- All Implemented Interfaces:
ChartPlot,java.io.Serializable
- Direct Known Subclasses:
GanttPlot,PiePlot,StandardPlot,StockPlot,XYPlot
public abstract class AbstractPlot extends java.lang.Object implements ChartPlot
A general plotting class with common properties used by all chart plots.- Since:
- 8.0
- See Also:
- Serialized Form
-
-
Nested Class Summary
Nested Classes Modifier and Type Class Description static classAbstractPlot.GradientSettingThe gradient paint setting for the colorization of the chart items.
-
Field Summary
Fields Modifier and Type Field Description static java.awt.Color[]DEFAULT_COLOR_SEQUENCEThe default order of colors.static floatDEFAULT_FOREGROUND_ALPHAThe default foreground alphastatic intDEFAULT_ITEM_LABEL_COLORDefault color of the item labels.static java.awt.FontDEFAULT_ITEM_LABEL_FONTDefault font of the item labels.static intDEFAULT_OUTLINE_COLORDefault outline color.static intDEFAULT_OUTLINE_STYLEDefault outline style.static intDEFAULT_OUTLINE_WIDTHDefault outline width.static java.lang.StringTOKEN_PLOTXML token for a plot element.
-
Constructor Summary
Constructors Constructor Description AbstractPlot()FOR INTERNAL USE ONLY
-
Method Summary
All Methods Instance Methods Abstract Methods Concrete Methods Modifier and Type Method Description intgetBackColor()Returns the ABGR value representing the background color.FormulaFieldgetColorFormula()Returns the color formula which determines the color at run-time.java.awt.Color[]getColorSequence()Returns the user defined color sequence of this chart plot.floatgetForegroundAlpha()Returns the alpha value for the foreground color: 1.0 is fully opaque, while 0.0 is fully transparent.AbstractPlot.GradientSettinggetGradientSetting()Returns the gradient paint settings.intgetItemLabelColor()Returns the ABGR value representing the color of the item labels.java.awt.FontgetItemLabelFont()Returns font for the item labels.ChartFormatgetItemLabelFormat()Returns the format for the item value.FormulaFieldgetItemLabelFormatFormula()Returns the format formula for the item values.ItemShapegetItemShape()Returns the item shape settings for this plot.intgetOutlineColor()Returns the ABGR value representing the chart items outline color.intgetOutlineStyle()Returns the chart items' outline style.intgetOutlineWidth()Returns the chart outline's width.java.util.ListgetReferencedObject()abstract ChartStylegetStyle()Returns the style of this chart, ie.protected java.lang.StringBuildergetSubProperties(int depth)Returns the serialized simple properties of subclasses.booleanisColorBySeries()Returns whether the chart items are colored by series or by groups.booleanisDrawOutline()Returns whether or not to draw the outline.booleanisSameColorsForSameGroups()Returns whether identical groups will have the same color.booleanisShowLabel()Returns whether or not to show labels in the plot.booleanisShowValue()Returns whether or not to show the values in the plot.voidreadProperties(org.w3c.dom.Element element, Chart2 chart)Reads the chart properties from the DOMParser Element.abstract voidrefreshAutoTitles(Chart2 chart)Reads out the data column names from dataset and refreshes the chart labels.voidsaveProperties(java.io.PrintWriter out, int depth)Writes the properties of this chart plot toPrintWriter.protected voidsaveSubProperties(java.io.PrintWriter out, int depth)Writes the intern properties to output.voidsetBackColor(int backgroundColor)Sets the ABGR value representing the background color.voidsetColorBySeries(boolean colorBySeries)Sets whether the chart items are colored by series or by groups.voidsetColorFormula(FormulaField colorFormula)Sets the color formula which determines the color at run-time.voidsetColorSequence(java.awt.Color[] colorSequence)Sets the user defined color sequence for this chart plot.voidsetDrawOutline(boolean drawOutline)Sets whether or not to draw the outline.voidsetForegroundAlpha(float foregroundAlpha)Sets the alpha (opaqueness) value for the foreground color: 1.0 is fully opaque, while 0.0 is fully transparent.voidsetGradientSetting(AbstractPlot.GradientSetting gradientSetting)Sets the gradient paint settings.voidsetItemLabelColor(int itemLabelColor)Sets the ABGR value representing the color of the item labels.voidsetItemLabelFont(java.awt.Font itemLabelFont)Sets the font of the item labels.voidsetItemLabelFormat(ChartFormat valueFormat)Sets the format for the item value.voidsetItemLabelFormatFormula(FormulaField itemLabelFormula)Set the format formula for the item values.voidsetItemShape(ItemShape itemShape)Sets the item shape properties for this plot.voidsetOutlineColor(int outlineColor)Sets the ABGR components of the chart items outline color.voidsetOutlineStyle(int outlineStyle)Sets the chart items' outline style.voidsetOutlineWidth(int outlineWidth)Sets the chart items' outline width (in twips).voidsetSameColorsForSameGroups(boolean sameColorsForSameGroups)Sets whether identical groups will have the same color.voidsetShowLabel(boolean showLabel)Sets whether or not to show labels in the plot.voidsetShowValue(boolean showValue)Sets whether or not to show the values in the plot.-
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
-
Methods inherited from interface com.inet.report.chart.plot.ChartPlot
getDataset
-
-
-
-
Field Detail
-
TOKEN_PLOT
public static final java.lang.String TOKEN_PLOT
XML token for a plot element.- See Also:
- Constant Field Values
-
DEFAULT_COLOR_SEQUENCE
public static final java.awt.Color[] DEFAULT_COLOR_SEQUENCE
The default order of colors.
-
DEFAULT_FOREGROUND_ALPHA
public static final float DEFAULT_FOREGROUND_ALPHA
The default foreground alpha- See Also:
- Constant Field Values
-
DEFAULT_ITEM_LABEL_FONT
public static final java.awt.Font DEFAULT_ITEM_LABEL_FONT
Default font of the item labels.
-
DEFAULT_ITEM_LABEL_COLOR
public static final int DEFAULT_ITEM_LABEL_COLOR
Default color of the item labels.- See Also:
- Constant Field Values
-
DEFAULT_OUTLINE_STYLE
public static final int DEFAULT_OUTLINE_STYLE
Default outline style.- See Also:
- Constant Field Values
-
DEFAULT_OUTLINE_WIDTH
public static final int DEFAULT_OUTLINE_WIDTH
Default outline width.- See Also:
- Constant Field Values
-
DEFAULT_OUTLINE_COLOR
public static final int DEFAULT_OUTLINE_COLOR
Default outline color.
-
-
Method Detail
-
getBackColor
public int getBackColor()
Returns the ABGR value representing the background color.- Returns:
- the color.
- Since:
- 8.0
- See Also:
setBackColor(int),ColorUtils.toJavaColor(int)
-
setBackColor
public void setBackColor(int backgroundColor)
Sets the ABGR value representing the background color.- Parameters:
backgroundColor- the background color- Since:
- 8.0
- See Also:
getBackColor(),ColorUtils.toCcColor(Color)
-
getItemShape
public ItemShape getItemShape()
Returns the item shape settings for this plot.- Returns:
- the ItemShape holding the item shape settings for this plot
- Since:
- 8.0
- See Also:
setItemShape(ItemShape),ItemShape
-
setItemShape
public void setItemShape(ItemShape itemShape)
Sets the item shape properties for this plot.- Parameters:
itemShape- the properties object (nullnot permitted)- Since:
- 8.0
- See Also:
getItemShape(),ItemShape
-
getOutlineColor
public int getOutlineColor()
Returns the ABGR value representing the chart items outline color.- Returns:
- the chart items' outline color.
- Since:
- 8.0
- See Also:
setOutlineColor(int),ColorUtils.toJavaColor(int)
-
setOutlineColor
public void setOutlineColor(int outlineColor)
Sets the ABGR components of the chart items outline color.- Parameters:
outlineColor- the chart items' outline color- Throws:
java.lang.IllegalArgumentException- if the color isRDC.COLOR_NO_COLOR.- Since:
- 8.0
- See Also:
getOutlineColor(),ColorUtils.toCcColor(Color)
-
getOutlineStyle
public int getOutlineStyle()
Returns the chart items' outline style.- Returns:
- style of the outline
- Since:
- 8.0
- See Also:
BorderPropertiesConstants.LINE_STYLE_DASHED,BorderPropertiesConstants.LINE_STYLE_DOTTED,BorderPropertiesConstants.LINE_STYLE_SINGLE,BorderPropertiesConstants.NO_LINE
-
setOutlineStyle
public void setOutlineStyle(int outlineStyle)
Sets the chart items' outline style. Chart items are the items used to visualize the data, e.g. bars.- Parameters:
outlineStyle- the style- Throws:
java.lang.IllegalArgumentException- if the parameter is not one of the supported outline styles- Since:
- 8.0
- See Also:
getOutlineStyle(),BorderPropertiesConstants.LINE_STYLE_DASHED,BorderPropertiesConstants.LINE_STYLE_DOTTED,BorderPropertiesConstants.LINE_STYLE_SINGLE,BorderPropertiesConstants.NO_LINE
-
getOutlineWidth
public int getOutlineWidth()
Returns the chart outline's width.- Returns:
- the width of the chart's outline.
- Since:
- 8.0
-
setOutlineWidth
public void setOutlineWidth(int outlineWidth)
Sets the chart items' outline width (in twips). Chart items are the items used to visualize the data, e.g. bars.- Parameters:
outlineWidth- the outline width of the chart items- Throws:
java.lang.IllegalArgumentException- if width is less than 1.- Since:
- 8.0
-
isDrawOutline
public boolean isDrawOutline()
Returns whether or not to draw the outline.- Returns:
truethe outline is to be drawn.- Since:
- 8.0
-
setDrawOutline
public void setDrawOutline(boolean drawOutline)
Sets whether or not to draw the outline.- Parameters:
drawOutline-trueif outline is to be drawn.- Since:
- 8.0
-
isShowLabel
public boolean isShowLabel()
Returns whether or not to show labels in the plot.- Returns:
trueif labels are to be shown.- Since:
- 8.0
-
setShowLabel
public void setShowLabel(boolean showLabel)
Sets whether or not to show labels in the plot.- Parameters:
showLabel-trueif labels are to be shown.- Since:
- 8.0
-
isShowValue
public boolean isShowValue()
Returns whether or not to show the values in the plot.- Returns:
trueif values are to be shown.- Since:
- 8.0
-
setShowValue
public void setShowValue(boolean showValue)
Sets whether or not to show the values in the plot.- Parameters:
showValue- settrueif values are to be shown.- Since:
- 8.0
-
getItemLabelFormat
public ChartFormat getItemLabelFormat()
Returns the format for the item value.- Returns:
- the format for the item value
- Since:
- 8.0
- See Also:
setItemLabelFormat(ChartFormat)
-
setItemLabelFormat
public void setItemLabelFormat(ChartFormat valueFormat)
Sets the format for the item value. The default value of this property isnull, which means that the values are to be formatted automatically. Note: for chart with number values, only formats extended fromNumberFormatare allowed, while for date charts, only formats extended fromDateFormatare allowed.- Parameters:
valueFormat- the format (nullpermitted)- Since:
- 8.0
- See Also:
getItemLabelFormat()
-
getItemLabelFormatFormula
public FormulaField getItemLabelFormatFormula()
Returns the format formula for the item values.- Returns:
- the format formula for the item values.
- Since:
- 22.10
- See Also:
setItemLabelFormatFormula(FormulaField)
-
setItemLabelFormatFormula
public void setItemLabelFormatFormula(FormulaField itemLabelFormula)
Set the format formula for the item values.- Parameters:
itemLabelFormula- the formula- Since:
- 22.10
-
isSameColorsForSameGroups
public boolean isSameColorsForSameGroups()
Returns whether identical groups will have the same color.- Returns:
trueif the same color is to be used for identical groups.- Since:
- 8.0
-
setSameColorsForSameGroups
public void setSameColorsForSameGroups(boolean sameColorsForSameGroups)
Sets whether identical groups will have the same color.- Parameters:
sameColorsForSameGroups-trueif the same color is to be used for identical groups.- Since:
- 8.0
-
getColorFormula
public FormulaField getColorFormula()
Returns the color formula which determines the color at run-time.- Returns:
- the colorFormula or
nullif there is none. - Since:
- 8.0
- See Also:
setColorFormula(FormulaField),FormulaField
-
setColorFormula
public void setColorFormula(FormulaField colorFormula)
Sets the color formula which determines the color at run-time. Note: this formula should have the typeFormulaField.FORMULA_PROPERTY.- Parameters:
colorFormula- the color formula (nullpermitted)- Throws:
java.lang.IllegalArgumentException- if the formula has the wrong type.- Since:
- 8.0
- See Also:
getColorFormula(),Fields.addFormulaField(String, String, int),FormulaField,FormulaField.getFormulaType()
-
getColorSequence
public java.awt.Color[] getColorSequence()
Returns the user defined color sequence of this chart plot. If this sequence was not set, the chart will use theDEFAULT_COLOR_SEQUENCE.- Returns:
- the color sequence or
nullwhich means the default color sequence will be used - Since:
- 8.0
- See Also:
setColorSequence(Color[])
-
setColorSequence
public void setColorSequence(java.awt.Color[] colorSequence)
Sets the user defined color sequence for this chart plot. If this sequence was not set chart uses theDEFAULT_COLOR_SEQUENCE.- Parameters:
colorSequence- the array of colors (nullpermitted)- Throws:
java.lang.IllegalArgumentException- if an empty color sequence is passed- Since:
- 8.0
- See Also:
getColorSequence(),DEFAULT_COLOR_SEQUENCE
-
getGradientSetting
public AbstractPlot.GradientSetting getGradientSetting()
Returns the gradient paint settings.- Returns:
- the settings or
nullwithout gradient paint for chart items - Since:
- 11.0
-
setGradientSetting
public void setGradientSetting(AbstractPlot.GradientSetting gradientSetting)
Sets the gradient paint settings.- Parameters:
gradientSetting- the gradient paint for the chart items (nullpermitted)- Since:
- 11.0
-
isColorBySeries
public boolean isColorBySeries()
Returns whether the chart items are colored by series or by groups.- Returns:
- true if the chart items are colored according to their series, and false if the chart items are colored according to their groups
- Since:
- 8.0
- See Also:
setColorBySeries(boolean)
-
setColorBySeries
public void setColorBySeries(boolean colorBySeries)
Sets whether the chart items are colored by series or by groups. This property works by Bar, Gantt and Chart3D only.- Parameters:
colorBySeries- true if the chart items are colored according to their series, and false if the chart items are colored according to their groups- Since:
- 8.0
- See Also:
isColorBySeries()
-
getForegroundAlpha
public float getForegroundAlpha()
Returns the alpha value for the foreground color: 1.0 is fully opaque, while 0.0 is fully transparent.- Returns:
- the alpha value for the foreground color, between 0.0 and 1.0
- Since:
- 8.0
-
setForegroundAlpha
public void setForegroundAlpha(float foregroundAlpha)
Sets the alpha (opaqueness) value for the foreground color: 1.0 is fully opaque, while 0.0 is fully transparent.- Parameters:
foregroundAlpha- the alpha value for the foreground color- Throws:
java.lang.IllegalArgumentException- if foregroundAlpha is less than 0.0 or greater than 1.0.- Since:
- 8.0
-
getItemLabelFont
public java.awt.Font getItemLabelFont()
Returns font for the item labels.- Returns:
- the font for the item labels
- Since:
- 8.0
- See Also:
setItemLabelFont(Font)
-
setItemLabelFont
public void setItemLabelFont(java.awt.Font itemLabelFont)
Sets the font of the item labels.- Parameters:
itemLabelFont- the font (nullnot permitted)- Since:
- 8.0
- See Also:
getItemLabelFont()
-
getItemLabelColor
public int getItemLabelColor()
Returns the ABGR value representing the color of the item labels. UseColorUtils.toJavaColor(int)to convert this value to a Java Color.- Returns:
- the color of the item labels as an int
- Since:
- 8.0
- See Also:
ColorUtils.toJavaColor(int),setItemLabelColor(int)
-
setItemLabelColor
public void setItemLabelColor(int itemLabelColor)
Sets the ABGR value representing the color of the item labels. UseColorUtils.toCcColor(Color)to convert a Java color to an int value.- Parameters:
itemLabelColor- ABGR components of the item labels' color- Throws:
java.lang.IllegalArgumentException- ifRDC.COLOR_NO_COLORis passed.- Since:
- 8.0
- See Also:
ColorUtils.toCcColor(Color),getItemLabelColor()
-
refreshAutoTitles
public abstract void refreshAutoTitles(Chart2 chart)
Reads out the data column names from dataset and refreshes the chart labels. Please use this function to refresh the chart labels if the data was be changed.- Specified by:
refreshAutoTitlesin interfaceChartPlot- Parameters:
chart- the chart
-
getStyle
public abstract ChartStyle getStyle()
Returns the style of this chart, ie. the general category this plot belongs to.- Returns:
- the style
- Since:
- 8.0
- See Also:
BarStyle.BAR2D,LineStyle.LINE_MARKER,AreaStyle.AREA2D_STACKED
-
getReferencedObject
public java.util.List getReferencedObject()
- Specified by:
getReferencedObjectin interfaceChartPlot- Returns:
- the list of objects.
-
saveProperties
public void saveProperties(java.io.PrintWriter out, int depth)Writes the properties of this chart plot toPrintWriter.- Specified by:
savePropertiesin interfaceChartPlot- Parameters:
out- the outputdepth- the depth of XML indent
-
getSubProperties
protected java.lang.StringBuilder getSubProperties(int depth)
Returns the serialized simple properties of subclasses.- Parameters:
depth- the depth of XML indent- Returns:
- the properties.
- Since:
- 8.0
-
saveSubProperties
protected void saveSubProperties(java.io.PrintWriter out, int depth)Writes the intern properties to output. Overwrites this to save intern properties direct toPrintWriterwithout building aStringBuilder.- Parameters:
out- the outputdepth- the depth of XML indent- Since:
- 8.0
-
readProperties
public void readProperties(org.w3c.dom.Element element, Chart2 chart)Reads the chart properties from the DOMParser Element.- Specified by:
readPropertiesin interfaceChartPlot- Parameters:
element- the DOMParser Elementchart- the chart
-
-