Package net.simplace.core.ui.jfreechart
Class BasicChartStyle
java.lang.Object
net.simplace.core.ui.jfreechart.AbstractChartStyle
net.simplace.core.ui.jfreechart.BasicChartStyle
- All Implemented Interfaces:
ChartStyle
This class provides a basis chart style for line, area an bar charts.
- Version:
- 1.0
- Author:
- Martin Schmitz
-
Nested Class Summary
Nested classes/interfaces inherited from interface net.simplace.core.ui.jfreechart.ChartStyle
ChartStyle.ChartType
-
Field Summary
Modifier and TypeFieldDescriptionprotected org.jfree.chart.plot.PlotOrientation
Stores the orientation of the chart.protected boolean
Stores whether the chart is stacked.protected boolean
Stores whether the chart is stepped.Fields inherited from class net.simplace.core.ui.jfreechart.AbstractChartStyle
iLegend, iObservable, iTitle, iTooltips, iType, iURLs, iXAxisTitle, iYAxisTitle
-
Constructor Summary
ConstructorDescriptionCreates a normal line style with default values.Creates a normal, vertical line, bar or area style.BasicChartStyle
(ChartStyle.ChartType aType, boolean aStacked, boolean aStepped, org.jfree.chart.plot.PlotOrientation aOrientation) Creates a line, area or bar chart style.BasicChartStyle
(ChartStyle.ChartType aType, boolean aStacked, boolean aStepped, org.jfree.chart.plot.PlotOrientation aOrientation, String aTitle, String aXTitle, String aYTitle, boolean aLegend, boolean aTooltips, boolean aURLs) Creates a chart style. -
Method Summary
Modifier and TypeMethodDescriptionorg.jfree.chart.JFreeChart
applyToDataset
(List<org.jfree.data.general.Dataset> aDataset) Generates a chart using the given data and the style represented by this class.org.jfree.chart.plot.PlotOrientation
Returns the orientation of the chart.boolean
Returns whether the chart is stacked.boolean
Returns whether the chart is stepped.void
setOrientation
(org.jfree.chart.plot.PlotOrientation aOrientation) Sets the orientation of the chart.void
setStacked
(boolean aStacked) Sets whether the chart is stacked.void
setStepped
(boolean aStepped) Sets whether the chart is stepped.void
setType
(ChartStyle.ChartType aType) Sets the type of the chart style.Methods inherited from class net.simplace.core.ui.jfreechart.AbstractChartStyle
getTitle, getType, getXAxisTitle, getYAxisTitle, hasLegend, hasTooltips, hasURLs, setLegend, setObservable, setTitle, setTooltips, setURLs, setXAxisTitle, setYAxisTitle
-
Field Details
-
iOrientation
protected org.jfree.chart.plot.PlotOrientation iOrientationStores the orientation of the chart. -
iStacked
protected boolean iStackedStores whether the chart is stacked. Line charts can never be stacked. -
iStepped
protected boolean iSteppedStores whether the chart is stepped. Bar charts are always stepped.
-
-
Constructor Details
-
BasicChartStyle
public BasicChartStyle()Creates a normal line style with default values. -
BasicChartStyle
Creates a normal, vertical line, bar or area style.- Parameters:
aType
- type of the chart layout
-
BasicChartStyle
public BasicChartStyle(ChartStyle.ChartType aType, boolean aStacked, boolean aStepped, org.jfree.chart.plot.PlotOrientation aOrientation) Creates a line, area or bar chart style.- Parameters:
aType
- style typeaStacked
- flag whether the chart is stacked (ignored for line charts)aStepped
- flag whether the chart is stepped (ignored for bar charts)aOrientation
- orientation of the chart (PlotOrientation.VERTICAL
orPlotOrientation.HORIZONTAL
)
-
BasicChartStyle
public BasicChartStyle(ChartStyle.ChartType aType, boolean aStacked, boolean aStepped, org.jfree.chart.plot.PlotOrientation aOrientation, String aTitle, String aXTitle, String aYTitle, boolean aLegend, boolean aTooltips, boolean aURLs) Creates a chart style.- Parameters:
aType
- style typeaStacked
- flag whether the chart is stacked (ignored for line charts)aStepped
- flag whether the chart is stepped (ignored for bar charts)aOrientation
- orientation of the chart (PlotOrientation.VERTICAL
orPlotOrientation.HORIZONTAL
)aTitle
- title for the chartaXTitle
- title for the chart's X-axisaYTitle
- title for the chart's Y-axisaLegend
- flag whether a legend is generatedaTooltips
- flag whether toolstips are generatedaURLs
- flag whether URLs are generated
-
-
Method Details
-
setType
Sets the type of the chart style.- Overrides:
setType
in classAbstractChartStyle
- Parameters:
aType
- the chart type- Throws:
IllegalArgumentException
- ifaType
is not ofChartStyle.ChartType.LINE
,ChartStyle.ChartType.AREA
orChartStyle.ChartType.BAR
-
isStacked
public boolean isStacked()Returns whether the chart is stacked.- Returns:
false
for line charts
-
setStacked
public void setStacked(boolean aStacked) Sets whether the chart is stacked. Sets theiStacked
property tofalse
for line charts, evenaStacked
istrue
.- Parameters:
aStacked
-
-
isStepped
public boolean isStepped()Returns whether the chart is stepped.- Returns:
true
for bar charts
-
setStepped
public void setStepped(boolean aStepped) Sets whether the chart is stepped. Sets theiStepped
property totrue
for bar charts, evenaStepped
isfalse
.- Parameters:
aStepped
-
-
getOrientation
public org.jfree.chart.plot.PlotOrientation getOrientation()Returns the orientation of the chart.- Returns:
-
setOrientation
public void setOrientation(org.jfree.chart.plot.PlotOrientation aOrientation) Sets the orientation of the chart.- Parameters:
aOrientation
-
-
applyToDataset
Generates a chart using the given data and the style represented by this class.- Parameters:
aDataset
- the data for the chart- Returns:
- JFreeChart
- Throws:
UnsupportedOperationException
- if the style can not be applied to the given dataset
-