Package com.inet.report.chart.plot
Class CombinedPlot
- java.lang.Object
-
- com.inet.report.chart.plot.CombinedPlot
-
- All Implemented Interfaces:
ChartPlot
,java.io.Serializable
public class CombinedPlot extends java.lang.Object implements ChartPlot
A general class for plotting data of different plots.- Since:
- 8.0
- See Also:
- Serialized Form
-
-
Field Summary
Fields Modifier and Type Field Description static int
COMBINE_MULTIPLE_PLOTS_WITH_COMMON_DATA_AXIS
This combine type allows show several charts side by side.static int
COMBINE_MULTIPLE_PLOTS_WITH_COMMON_GROUP_AXIS
This combine type allows show several charts side by side.static int
COMBINE_ONE_PLOT_WITH_COMMON_DATA_AXIS
This combine type allows show several charts in same plot.static int
COMBINE_ONE_PLOT_WITH_COMMON_GROUP_AXIS
This combine type allows show several charts in same plot.static java.lang.String
TOKEN_COMBINED_PLOT
XML token for a combined plot element.
-
Constructor Summary
Constructors Constructor Description CombinedPlot()
Creates a empty CombinedPlot.CombinedPlot(int combineType)
Creates a empty CombinedPlot.
-
Method Summary
All Methods Instance Methods Concrete Methods Modifier and Type Method Description void
addPlot(AbstractPlot plot)
The list of plots contains either only one unspecified plot or more combinable plots.int
getCombineType()
Returns the combine type.BaseDataset
getDataset()
Returns nothing (null
).AbstractPlot
getPlot(int index)
Returns the chart plot at the specified position in this list.java.util.List
getReferencedObject()
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.AbstractPlot
removePlot(int index)
Removes the chart plot at the specified position in this list.void
saveProperties(java.io.PrintWriter out, int depth)
Writes the properties of this chart plot toPrintWriter
.void
setCombineType(int combineType)
Sets the combine type.int
size()
Returns the number of chart plots in this list.
-
-
-
Field Detail
-
TOKEN_COMBINED_PLOT
public static final java.lang.String TOKEN_COMBINED_PLOT
XML token for a combined plot element.- See Also:
- Constant Field Values
-
COMBINE_ONE_PLOT_WITH_COMMON_GROUP_AXIS
public static final int COMBINE_ONE_PLOT_WITH_COMMON_GROUP_AXIS
This combine type allows show several charts in same plot. The common axis is the category axis.- See Also:
- Constant Field Values
-
COMBINE_ONE_PLOT_WITH_COMMON_DATA_AXIS
public static final int COMBINE_ONE_PLOT_WITH_COMMON_DATA_AXIS
This combine type allows show several charts in same plot. The common axis is the data axis.- See Also:
- Constant Field Values
-
COMBINE_MULTIPLE_PLOTS_WITH_COMMON_GROUP_AXIS
public static final int COMBINE_MULTIPLE_PLOTS_WITH_COMMON_GROUP_AXIS
This combine type allows show several charts side by side. The common axis is the category axis.- See Also:
- Constant Field Values
-
COMBINE_MULTIPLE_PLOTS_WITH_COMMON_DATA_AXIS
public static final int COMBINE_MULTIPLE_PLOTS_WITH_COMMON_DATA_AXIS
This combine type allows show several charts side by side. The common axis is the data axis.- See Also:
- Constant Field Values
-
-
Constructor Detail
-
CombinedPlot
public CombinedPlot()
Creates a empty CombinedPlot. The CombinedPlot is a container for CombinablePlot and CombinableContinuousPlot. This allows to display more than one chart in same plot. Sets the default combine type with all charts in one plot and with common category axis.- Since:
- 8.0
- See Also:
setCombineType(int)
-
CombinedPlot
public CombinedPlot(int combineType)
Creates a empty CombinedPlot. The CombinedPlot is a container for CombinablePlot and CombinableContinuousPlot. This allows to display more than one chart in same plot.- Parameters:
combineType
- the type of combining- Throws:
java.lang.IllegalArgumentException
- by unknown combine type- Since:
- 8.0
- See Also:
setCombineType(int)
,COMBINE_MULTIPLE_PLOTS_WITH_COMMON_GROUP_AXIS
,COMBINE_MULTIPLE_PLOTS_WITH_COMMON_DATA_AXIS
,COMBINE_ONE_PLOT_WITH_COMMON_GROUP_AXIS
,COMBINE_ONE_PLOT_WITH_COMMON_DATA_AXIS
-
-
Method Detail
-
addPlot
public void addPlot(AbstractPlot plot)
The list of plots contains either only one unspecified plot or more combinable plots. Appends the current plot to the end of this list. Note: you can combine only 2D plot asBarPlot
,LinePlot
,AreaPlot
orContinuousAreaPlot
,ContinuousBarPlot
,ContinuousLinePlot
.- Parameters:
plot
- the plot to be appended to this list- Throws:
java.lang.IllegalArgumentException
- if this plot is not combinable or by unsupported combination of plots.- Since:
- 8.0
- See Also:
getPlot(int)
,removePlot(int)
,size()
,AbstractPlot
-
removePlot
public AbstractPlot removePlot(int index)
Removes the chart plot at the specified position in this list. Shifts any subsequent elements to the left (subtracts one from their indices).- Parameters:
index
- the index of the plot to removed- Returns:
- the plot that was removed from the list.
- Throws:
java.lang.IndexOutOfBoundsException
- if index out of range(index < 0 || index >= size())
.- Since:
- 8.0
- See Also:
addPlot(AbstractPlot)
,getPlot(int)
,size()
,AbstractPlot
-
getPlot
public AbstractPlot getPlot(int index)
Returns the chart plot at the specified position in this list.- Parameters:
index
- index of plot to return- Returns:
- the chart plot at the specified position in this list.
- Throws:
java.lang.IndexOutOfBoundsException
- if index is out of range(index < 0 || index >= size())
.- Since:
- 8.0
- See Also:
addPlot(AbstractPlot)
,removePlot(int)
,size()
,AbstractPlot
-
size
public int size()
Returns the number of chart plots in this list.- Returns:
- the number of plots in this list.
- Since:
- 8.0
- See Also:
addPlot(AbstractPlot)
,removePlot(int)
,getPlot(int)
-
getCombineType
public int getCombineType()
Returns the combine type. Several charts side by side or several charts in a same plot.- Returns:
- the combine type.
- Since:
- 8.0
- See Also:
setCombineType(int)
,COMBINE_MULTIPLE_PLOTS_WITH_COMMON_GROUP_AXIS
,COMBINE_MULTIPLE_PLOTS_WITH_COMMON_DATA_AXIS
,COMBINE_ONE_PLOT_WITH_COMMON_GROUP_AXIS
,COMBINE_ONE_PLOT_WITH_COMMON_DATA_AXIS
-
setCombineType
public void setCombineType(int combineType)
Sets the combine type. This flag controls the charts displayed side by side or in a same plot and the common axis of all charts.- Parameters:
combineType
- the type.- Throws:
java.lang.IllegalArgumentException
- if unsupported combination of plots.- Since:
- 8.0
- See Also:
getCombineType()
,COMBINE_MULTIPLE_PLOTS_WITH_COMMON_GROUP_AXIS
,COMBINE_MULTIPLE_PLOTS_WITH_COMMON_DATA_AXIS
,COMBINE_ONE_PLOT_WITH_COMMON_GROUP_AXIS
,COMBINE_ONE_PLOT_WITH_COMMON_DATA_AXIS
-
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
- Parameters:
chart
- the chart
-
saveProperties
public void saveProperties(java.io.PrintWriter out, int depth)
Writes the properties of this chart plot toPrintWriter
.- Specified by:
saveProperties
in interfaceChartPlot
- Parameters:
out
- the outputdepth
- the depth of XML indent
-
getReferencedObject
public java.util.List getReferencedObject()
- Specified by:
getReferencedObject
in interfaceChartPlot
- Returns:
- the list of objects.
-
readProperties
public void readProperties(org.w3c.dom.Element element, Chart2 chart)
Reads the chart properties from the DOMParser Element.- Specified by:
readProperties
in interfaceChartPlot
- Parameters:
element
- the DOMParser Elementchart
- the chart
-
getDataset
public BaseDataset getDataset()
Returns nothing (null
). To gets the datasets of this chart usegetPlot(int)
abdChartPlot.getDataset()
of each plot.- Specified by:
getDataset
in interfaceChartPlot
- Returns:
- the dataset.
- Since:
- 8.0
- See Also:
ChartPlot.getDataset()
-
-