Package com.inet.report.chart.plot
Class PiePlot
- java.lang.Object
-
- com.inet.report.chart.plot.AbstractPlot
-
- com.inet.report.chart.plot.PiePlot
-
- All Implemented Interfaces:
ChartPlot
,java.io.Serializable
- Direct Known Subclasses:
MultiplePiePlot
public class PiePlot extends AbstractPlot
A general class for plotting data of groups of values. This plot can use data from any class that implements theBaseDataset
interface.- Since:
- 8.0
- See Also:
- Serialized Form
-
-
Nested Class Summary
-
Nested classes/interfaces inherited from class com.inet.report.chart.plot.AbstractPlot
AbstractPlot.GradientSetting
-
-
Field Summary
Fields Modifier and Type Field Description static double
DEFAULT_EXPAND_PERCENT
The default expand percent.static int
DEFAULT_ITEM_LABEL_BACKGROUND_COLOR
The default background color of the item label.static double
DEFAULT_ITEM_LABEL_GAP
The default gap of the item labels.static int
DEFAULT_ITEM_LABEL_OUTLINE_COLOR
The default outline color of the item label.static int
DEFAULT_ITEM_LABEL_OUTLINE_STYLE
The default outline style of the item label.static int
DEFAULT_ITEM_LABEL_OUTLINE_WIDTH
The default outline width of the item label.static double
DEFAULT_ROTATION_ANGLE
The default rotating angle.static PieStyle
DEFAULT_STYLE
Default chart style with this plot.-
Fields inherited from class com.inet.report.chart.plot.AbstractPlot
DEFAULT_COLOR_SEQUENCE, DEFAULT_FOREGROUND_ALPHA, DEFAULT_ITEM_LABEL_COLOR, DEFAULT_ITEM_LABEL_FONT, DEFAULT_OUTLINE_COLOR, DEFAULT_OUTLINE_STYLE, DEFAULT_OUTLINE_WIDTH, TOKEN_PLOT
-
-
Method Summary
All Methods Instance Methods Concrete Methods Modifier and Type Method Description BaseDataset
getDataset()
Returns a dataset of typePieDataset
.double
getExpandPercent()
Returns the detach percentage of sections selected withsetSectionIndexes(int[])
.int
getItemLabelBackColor()
Returns the ABGR value representing the background color of item labels .double
getItemLabelGap()
Returns the gap between the pie and the item label.int
getItemLabelOutlineColor()
Returns the ABGR value representing the legend outline color.int
getItemLabelOutlineStyle()
Returns the border line style of item labels.int
getItemLabelOutlineWidth()
Returns the outline width of item labels.PieLegendLayout
getLegendLayout()
Returns the legend layout.double
getRotationAngle()
Returns the rotation angle of pie.int[]
getSectionIndexes()
Returns the sections indexes which will be expanded.ChartStyle
getStyle()
Returns the style of this chart, ie. the general category this plot belongs to.protected java.lang.StringBuilder
getSubProperties(int depth)
Returns the serialized simple properties of subclasses.boolean
isDrawItemLabelOutline()
Returns whether or not to draw the item label outline.boolean
isIgnoreZeroValues()
Returns the flag that controls whether or not the null and zero values will be ignored.protected void
readDataset(org.w3c.dom.Element element, Chart2 chart)
Reads the dataset properties from DOM element.void
readProperties(org.w3c.dom.Element element, Chart2 chart)
Reads the chart properties from the DOMParser Element.void
refreshAutoTitles(Chart2 chart)
Reads out the data column names from dataset and refreshes the chart labels.protected void
saveSubProperties(java.io.PrintWriter out, int depth)
Writes the intern properties to output.void
setDataset(PieDataset dataset)
Sets a pie dataset for this chart.void
setDrawItemLabelOutline(boolean drawOutline)
Sets whether or not to draw the item label outline.void
setExpandPercent(double expandPercent)
Sets the detach percentage of sections selected withsetSectionIndexes(int[])
.void
setIgnoreZeroValues(boolean ignoreZeroValues)
Sets the flag that controls whether or not the null and zero values will be ignored.void
setItemLabelBackColor(int backgroundColor)
Sets the ABGR value representing the background color of item labels.void
setItemLabelGap(double itemLabelGap)
Sets the gap between the pie and the item label.void
setItemLabelOutlineColor(int outlineColor)
Sets the ABGR components of the legend outline color.void
setItemLabelOutlineStyle(int itemLabelOutlineStyle)
Sets the border line style of item labels.void
setItemLabelOutlineWidth(int itemLabelOutlineWidth)
Sets the item labels outline width in twips.void
setLegendLayout(PieLegendLayout legendLayout)
Sets the legend layout.void
setRotationAngle(double rotationAngle)
Sets the rotation angle of pie.void
setSectionIndexes(int[] sectionIndexes)
Sets the sections indexes which will be expanded.void
setStyle(PieStyle style)
Sets the chart style of this plot.-
Methods inherited from class com.inet.report.chart.plot.AbstractPlot
getBackColor, getColorFormula, getColorSequence, getForegroundAlpha, getGradientSetting, getItemLabelColor, getItemLabelFont, getItemLabelFormat, getItemShape, getOutlineColor, getOutlineStyle, getOutlineWidth, getReferencedObject, isColorBySeries, isDrawOutline, isSameColorsForSameGroups, isShowLabel, isShowValue, saveProperties, setBackColor, setColorBySeries, setColorFormula, setColorSequence, setDrawOutline, setForegroundAlpha, setGradientSetting, setItemLabelColor, setItemLabelFont, setItemLabelFormat, setItemShape, setOutlineColor, setOutlineStyle, setOutlineWidth, setSameColorsForSameGroups, setShowLabel, setShowValue
-
-
-
-
Field Detail
-
DEFAULT_STYLE
public static final PieStyle DEFAULT_STYLE
Default chart style with this plot.
-
DEFAULT_ROTATION_ANGLE
public static final double DEFAULT_ROTATION_ANGLE
The default rotating angle.- See Also:
- Constant Field Values
-
DEFAULT_ITEM_LABEL_GAP
public static final double DEFAULT_ITEM_LABEL_GAP
The default gap of the item labels.- See Also:
- Constant Field Values
-
DEFAULT_ITEM_LABEL_BACKGROUND_COLOR
public static final int DEFAULT_ITEM_LABEL_BACKGROUND_COLOR
The default background color of the item label.
-
DEFAULT_ITEM_LABEL_OUTLINE_COLOR
public static final int DEFAULT_ITEM_LABEL_OUTLINE_COLOR
The default outline color of the item label.- See Also:
- Constant Field Values
-
DEFAULT_ITEM_LABEL_OUTLINE_STYLE
public static final int DEFAULT_ITEM_LABEL_OUTLINE_STYLE
The default outline style of the item label.- See Also:
- Constant Field Values
-
DEFAULT_ITEM_LABEL_OUTLINE_WIDTH
public static final int DEFAULT_ITEM_LABEL_OUTLINE_WIDTH
The default outline width of the item label.- See Also:
- Constant Field Values
-
DEFAULT_EXPAND_PERCENT
public static final double DEFAULT_EXPAND_PERCENT
The default expand percent.- See Also:
- Constant Field Values
-
-
Method Detail
-
getDataset
public BaseDataset getDataset()
Returns a dataset of typePieDataset
.- Returns:
- the dataset
- Since:
- 8.0
- See Also:
setDataset(PieDataset)
,ForAllRecordsDataset
,ForEachRecordDataset
,OneGroupDataset
-
setDataset
public void setDataset(PieDataset dataset)
Sets a pie dataset for this chart.- Parameters:
dataset
- the pie dataset (null
not permitted)- Since:
- 8.0
- See Also:
getDataset()
,PieDataset
,ForAllRecordsDataset
,ForEachRecordDataset
,OneGroupDataset
-
getStyle
public ChartStyle getStyle()
Returns the style of this chart, ie. the general category this plot belongs to.- Specified by:
getStyle
in classAbstractPlot
- Returns:
- the style
- See Also:
BarStyle.BAR2D
,LineStyle.LINE_MARKER
,AreaStyle.AREA2D_STACKED
-
setStyle
public void setStyle(PieStyle style)
Sets the chart style of this plot.- Parameters:
style
- the style- Since:
- 8.0
- See Also:
getStyle()
,PieStyle
-
isIgnoreZeroValues
public boolean isIgnoreZeroValues()
Returns the flag that controls whether or not the null and zero values will be ignored. Default value of this property isfalse
.- Returns:
- the flag.
- Since:
- 8.0
- See Also:
setIgnoreZeroValues(boolean)
-
setIgnoreZeroValues
public void setIgnoreZeroValues(boolean ignoreZeroValues)
Sets the flag that controls whether or not the null and zero values will be ignored. Default value of this property isfalse
.- Parameters:
ignoreZeroValues
- the flag- Since:
- 8.0
- See Also:
isIgnoreZeroValues()
-
getRotationAngle
public double getRotationAngle()
Returns the rotation angle of pie. The pie is default rotated on clockwise 90 degrees.- Returns:
- the rotation angle.
- Since:
- 8.0
- See Also:
setRotationAngle(double)
-
setRotationAngle
public void setRotationAngle(double rotationAngle)
Sets the rotation angle of pie. The pie is default rotated on clockwise 90 degrees. The default value isDEFAULT_ROTATION_ANGLE
- Parameters:
rotationAngle
- the rotation angle- Since:
- 8.0
- See Also:
getRotationAngle()
-
getItemLabelGap
public double getItemLabelGap()
Returns the gap between the pie and the item label. The value of gap is a percentage of the plot width.- Returns:
- the gap
- Since:
- 8.0
- See Also:
setItemLabelGap(double)
-
setItemLabelGap
public void setItemLabelGap(double itemLabelGap)
Sets the gap between the pie and the item label. The value of gap is a percentage of the plot width. The default value isDEFAULT_ITEM_LABEL_GAP
.- Parameters:
itemLabelGap
- the item label gap- Throws:
java.lang.IllegalArgumentException
- if the gap is a negative value.- Since:
- 8.0
- See Also:
getItemLabelGap()
-
isDrawItemLabelOutline
public boolean isDrawItemLabelOutline()
Returns whether or not to draw the item label outline.- Returns:
true
the outline is to be drawn.- Since:
- 8.0
- See Also:
setDrawItemLabelOutline(boolean)
-
setDrawItemLabelOutline
public void setDrawItemLabelOutline(boolean drawOutline)
Sets whether or not to draw the item label outline.- Parameters:
drawOutline
-true
if outline is to be drawn.- Since:
- 8.0
- See Also:
isDrawItemLabelOutline()
-
getItemLabelBackColor
public int getItemLabelBackColor()
Returns the ABGR value representing the background color of item labels .- Returns:
- the background color.
- Since:
- 8.0
- See Also:
setItemLabelBackColor(int)
,ColorUtils.toJavaColor(int)
-
setItemLabelBackColor
public void setItemLabelBackColor(int backgroundColor)
Sets the ABGR value representing the background color of item labels.- Parameters:
backgroundColor
- the background color- Since:
- 8.0
- See Also:
getItemLabelBackColor()
,ColorUtils.toCcColor(Color)
-
getItemLabelOutlineColor
public int getItemLabelOutlineColor()
Returns the ABGR value representing the legend outline color.- Returns:
- the legend outline color.
- Since:
- 8.0
- See Also:
AbstractPlot.setOutlineColor(int)
,ColorUtils.toJavaColor(int)
-
setItemLabelOutlineColor
public void setItemLabelOutlineColor(int outlineColor)
Sets the ABGR components of the legend outline color.- Parameters:
outlineColor
- a color- Throws:
java.lang.IllegalArgumentException
- if the color isRDC.COLOR_NO_COLOR
.- Since:
- 8.0
- See Also:
AbstractPlot.getOutlineColor()
,ColorUtils.toCcColor(Color)
-
getItemLabelOutlineStyle
public int getItemLabelOutlineStyle()
Returns the border line style of item labels.- Returns:
- outline style.
- Since:
- 8.0
- See Also:
setItemLabelOutlineStyle(int)
-
setItemLabelOutlineStyle
public void setItemLabelOutlineStyle(int itemLabelOutlineStyle)
Sets the border line style of item labels.- Parameters:
itemLabelOutlineStyle
- a outline style- Throws:
java.lang.IllegalArgumentException
- by unsupported line style.- Since:
- 8.0
- See Also:
getItemLabelOutlineStyle()
,BorderPropertiesConstants.LINE_STYLE_DASHED
,BorderPropertiesConstants.LINE_STYLE_DOTTED
,BorderPropertiesConstants.LINE_STYLE_SINGLE
,BorderPropertiesConstants.NO_LINE
-
getItemLabelOutlineWidth
public int getItemLabelOutlineWidth()
Returns the outline width of item labels.- Returns:
- the outline width in twips.
- Since:
- 8.0
- See Also:
setItemLabelOutlineWidth(int)
-
setItemLabelOutlineWidth
public void setItemLabelOutlineWidth(int itemLabelOutlineWidth)
Sets the item labels outline width in twips.- Parameters:
itemLabelOutlineWidth
- the outline width- Throws:
java.lang.IllegalArgumentException
- if width is less than 1.- Since:
- 8.0
- See Also:
getItemLabelOutlineWidth()
-
getLegendLayout
public PieLegendLayout getLegendLayout()
Returns the legend layout. A legend can show section names, data values and percentage of values.- Returns:
- the legend layout.
- Since:
- 8.0
- See Also:
setLegendLayout(PieLegendLayout)
,PieLegendLayout
-
setLegendLayout
public void setLegendLayout(PieLegendLayout legendLayout)
Sets the legend layout. A legend can show section names, data values and percentage of values.- Parameters:
legendLayout
- a legend layout (null
not permitted)- Since:
- 8.0
- See Also:
getLegendLayout()
,PieLegendLayout
-
getSectionIndexes
public int[] getSectionIndexes()
Returns the sections indexes which will be expanded.- Returns:
- the array of indexes.
- Since:
- 8.0
- See Also:
setSectionIndexes(int[])
-
setSectionIndexes
public void setSectionIndexes(int[] sectionIndexes)
Sets the sections indexes which will be expanded. This function define the sections of pie which are detached. The value of the detach distance you can set withsetExpandPercent(double)
. The array of indexes is 0 based.- Parameters:
sectionIndexes
- the array of sections indexes (null
not permitted)- Throws:
java.lang.IllegalArgumentException
- if the array isnull
.- Since:
- 8.0
- See Also:
getSectionIndexes()
,setExpandPercent(double)
-
getExpandPercent
public double getExpandPercent()
Returns the detach percentage of sections selected withsetSectionIndexes(int[])
.- Returns:
- the percentage value.
- Since:
- 8.0
- See Also:
setExpandPercent(double)
-
setExpandPercent
public void setExpandPercent(double expandPercent)
Sets the detach percentage of sections selected withsetSectionIndexes(int[])
.- Parameters:
expandPercent
- the expand percentage (0.30 = 30 percent)- Throws:
java.lang.IllegalArgumentException
- if the percent is a negative value.- Since:
- 8.0
- See Also:
getExpandPercent()
,setSectionIndexes(int[])
-
refreshAutoTitles
public 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:
refreshAutoTitles
in interfaceChartPlot
- Specified by:
refreshAutoTitles
in classAbstractPlot
- Parameters:
chart
- the chart
-
getSubProperties
protected java.lang.StringBuilder getSubProperties(int depth)
Returns the serialized simple properties of subclasses.- Overrides:
getSubProperties
in classAbstractPlot
- Parameters:
depth
- the depth of XML indent- Returns:
- the properties.
-
saveSubProperties
protected void saveSubProperties(java.io.PrintWriter out, int depth)
Writes the intern properties to output. Overwrites this to save intern properties direct toPrintWriter
without building aStringBuilder
.- Overrides:
saveSubProperties
in classAbstractPlot
- Parameters:
out
- the outputdepth
- the depth of XML indent
-
readProperties
public void readProperties(org.w3c.dom.Element element, Chart2 chart)
Reads the chart properties from the DOMParser Element.- Specified by:
readProperties
in interfaceChartPlot
- Overrides:
readProperties
in classAbstractPlot
- Parameters:
element
- the DOMParser Elementchart
- the chart
-
readDataset
protected void readDataset(org.w3c.dom.Element element, Chart2 chart)
Reads the dataset properties from DOM element.- Parameters:
element
- the DOM elementchart
- the chart- Since:
- 8.0
-
-