schmitzm.jfree.feature.style
Class FeatureBasicChartStyle

java.lang.Object
  extended by schmitzm.jfree.chart.style.AbstractChartStyle
      extended by schmitzm.jfree.chart.style.BasicChartStyle
          extended by schmitzm.jfree.feature.style.FeatureBasicChartStyle
All Implemented Interfaces:
ChartStyle, FeatureChartStyle, Copyable<ChartStyle>

public class FeatureBasicChartStyle
extends BasicChartStyle
implements FeatureChartStyle

This class extends the BasicChartStyle with the properties of the FeatureChartStyle.
After instantiation the 2 feature attributes used to define the chart data must be set by setAttributeName(int, String). Without setting the attributes the style can not be applied to a feature collection!

Author:
Martin Schmitz

Nested Class Summary
 
Nested classes/interfaces inherited from interface schmitzm.jfree.feature.style.FeatureChartStyle
FeatureChartStyle.Dummy
 
Field Summary
protected  FeatureChartStyle.Dummy dummyFeatureChartStyle
          Used to maintain the FeatureChartStyle properties.
 
Fields inherited from class schmitzm.jfree.chart.style.BasicChartStyle
stacked, stepped
 
Fields inherited from class schmitzm.jfree.chart.style.AbstractChartStyle
axisStyle, bgPaint, borderVisible, descStyle, id, legend, LOGGER, maxRendererDatasetIdx, orientation, plotStyle, rendererStyle, TIPGEN_CAT, TIPGEN_XY, titleStyle, tooltips, type, URLGEN_CAT, URLGEN_XY, urls
 
Fields inherited from interface schmitzm.jfree.chart.style.ChartStyle
DOMAIN_AXIS, LOGGER, RANGE_AXIS, RANGE_AXIS2, X_AXIS, Y_AXIS, Y_AXIS_LEFT, Y_AXIS_RIGHT, Y_AXIS2
 
Constructor Summary
FeatureBasicChartStyle(String id)
          Creates a normal line style with default values.
FeatureBasicChartStyle(String id, ChartType type)
          Creates a normal, vertical line, bar or area style.
 
Method Summary
 void addNoDataValue(int idx, Object noDataValue)
          Sets a value, which is interpreted as "No Data".
 JFreeChart applyToFeatureCollection(FeatureCollection fc)
          Creates an appropriate Dataset for the attributes defined by this style (according to the attributes types in the given FeatureCollection) and calls BasicChartStyle.applyToDataset(Dataset).
 FeatureBasicChartStyle copy()
          Creates a (deep) clone of this style.
 ChartStyle copyTo(ChartStyle dest)
          Copies all properties of this style to another one.
<T> T
filterNoDataValue(int idx, T value)
          Checks whether the given value is one of the "No data" values for the attribute.
 int getAttributeCount()
          Returns the number of feature attributes defined in this style.
 String getAttributeName(int idx)
          Returns the name of a feature attribute needed to create a chart for this style.
 int getMaxAttributeCount()
          Returns the maximum number of feature attributes that can be specified by this style.
 Set<Object> getNoDataValues(int idx)
          Returns the values, which are interpreted as "No Data".
 boolean isAttributeNormalized(int idx)
          Returns whether the attribute data is normalized for an attribute(before creating a Dataset).
 boolean isForceCategories()
          Returns whether a CategoryDataset is forced for a numeric domain attribute.
 boolean isNoDataValue(int idx, Object value)
          Checks whether the given value is one of the "No data" values for the attribute.
 boolean isSortDomainAxis()
          Returns whether the features are sorted according to the domain attribute (before creating a Dataset).
 void removeAttribute(int idx)
          Removes all style informations about an attribute and reorganizes the attribute indexes so there is an continuous order.
 boolean removeNoDataValue(int idx, Object noDataValue)
          Removes a "No Data" value for an attribute.
 void setAttributeName(int idx, String attrName)
          Sets the name of a feature attribute needed to create a chart for this style.
 void setAttributeNormalized(int idx, Boolean normalize)
          Sets whether the attribute data is normalized for an attribute(before creating a Dataset).
 void setForceCategories(boolean forceCategories)
          Sets whether a CategoryDataset is forced for a numeric domain attribute.
 void setNoDataValues(int idx, Set<Object> noDataValues)
          Sets the values, which are interpreted as "No Data".
 void setSortDomainAxis(boolean sortDomainAxis)
          Sets whether the features are sorted according to the domain attribute (before creating a Dataset).
 
Methods inherited from class schmitzm.jfree.chart.style.BasicChartStyle
applyToChart, applyToDataset, isStacked, isStepped, setStacked, setStepped, setType, throwUnsupportedTypeException
 
Methods inherited from class schmitzm.jfree.chart.style.AbstractChartStyle
getAxisCount, getAxisStyle, getBackground, getDescStyle, getID, getOrientation, getPlotStyle, getRendererCount, getRendererStyle, getTitleStyle, getType, hasLegend, hasTooltips, hasURLs, isBorderVisible, setAxisStyle, setBackground, setBorderVisible, setDescStyle, setLegend, setOrientation, setPlotStyle, setRendererStyle, setTitleStyle, setTooltips, setURLs
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 
Methods inherited from interface schmitzm.jfree.chart.style.ChartStyle
applyToChart, applyToDataset, getAxisCount, getAxisStyle, getBackground, getDescStyle, getID, getOrientation, getPlotStyle, getRendererCount, getRendererStyle, getTitleStyle, getType, hasLegend, hasTooltips, hasURLs, isBorderVisible, setAxisStyle, setBackground, setBorderVisible, setDescStyle, setLegend, setOrientation, setPlotStyle, setRendererStyle, setTitleStyle, setTooltips, setURLs
 

Field Detail

dummyFeatureChartStyle

protected FeatureChartStyle.Dummy dummyFeatureChartStyle
Used to maintain the FeatureChartStyle properties.

Constructor Detail

FeatureBasicChartStyle

public FeatureBasicChartStyle(String id)
Creates a normal line style with default values.

Parameters:
id - a (unique) ID for the style

FeatureBasicChartStyle

public FeatureBasicChartStyle(String id,
                              ChartType type)
Creates a normal, vertical line, bar or area style.

Parameters:
id - a (unique) ID for the style
type - type of the chart layout
Method Detail

copy

public FeatureBasicChartStyle copy()
Creates a (deep) clone of this style.

Specified by:
copy in interface Copyable<ChartStyle>
Overrides:
copy in class BasicChartStyle

copyTo

public ChartStyle copyTo(ChartStyle dest)
Copies all properties of this style to another one.

Specified by:
copyTo in interface Copyable<ChartStyle>
Overrides:
copyTo in class BasicChartStyle
Parameters:
dest - destination object (if null the copy is created by copy())
Returns:
dest or the new instance

removeAttribute

public void removeAttribute(int idx)
Removes all style informations about an attribute and reorganizes the attribute indexes so there is an continuous order.

Specified by:
removeAttribute in interface FeatureChartStyle
Parameters:
idx - an attribute

getMaxAttributeCount

public int getMaxAttributeCount()
Returns the maximum number of feature attributes that can be specified by this style.

Specified by:
getMaxAttributeCount in interface FeatureChartStyle
Returns:
always -1 which indicates no limit

getAttributeCount

public int getAttributeCount()
Returns the number of feature attributes defined in this style.

Specified by:
getAttributeCount in interface FeatureChartStyle

getAttributeName

public String getAttributeName(int idx)
Returns the name of a feature attribute needed to create a chart for this style.

Specified by:
getAttributeName in interface FeatureChartStyle
Parameters:
idx - attribute index (0=domain; 1=1st range series; 2=2nd range series; ...)

setAttributeName

public void setAttributeName(int idx,
                             String attrName)
Sets the name of a feature attribute needed to create a chart for this style.

Specified by:
setAttributeName in interface FeatureChartStyle
Parameters:
idx - attribute index (0=domain; 1=1st range series; 2=2nd range series; ...)
attrName - feature attribute name

setSortDomainAxis

public void setSortDomainAxis(boolean sortDomainAxis)
Sets whether the features are sorted according to the domain attribute (before creating a Dataset).

Specified by:
setSortDomainAxis in interface FeatureChartStyle

isSortDomainAxis

public boolean isSortDomainAxis()
Returns whether the features are sorted according to the domain attribute (before creating a Dataset).

Specified by:
isSortDomainAxis in interface FeatureChartStyle
Returns:
false as default

setForceCategories

public void setForceCategories(boolean forceCategories)
Sets whether a CategoryDataset is forced for a numeric domain attribute. The default is to create XYDataset for a numeric and CategoryDataset for a non-numeric domain attribute.

Specified by:
setForceCategories in interface FeatureChartStyle

isForceCategories

public boolean isForceCategories()
Returns whether a CategoryDataset is forced for a numeric domain attribute. The default is to create XYDataset for a numeric and CategoryDataset for a non-numeric domain attribute.

Specified by:
isForceCategories in interface FeatureChartStyle
Returns:
false as default

setAttributeNormalized

public void setAttributeNormalized(int idx,
                                   Boolean normalize)
Sets whether the attribute data is normalized for an attribute(before creating a Dataset).

Specified by:
setAttributeNormalized in interface FeatureChartStyle
Parameters:
idx - attribute index (0=domain; 1=1st range series; 2=2nd range series; ...)
normalize - indicates the normalize property

isAttributeNormalized

public boolean isAttributeNormalized(int idx)
Returns whether the attribute data is normalized for an attribute(before creating a Dataset).

Specified by:
isAttributeNormalized in interface FeatureChartStyle
Parameters:
idx - attribute index (0=domain; 1=1st range series; 2=2nd range series; ...)
Returns:
false as default

setNoDataValues

public void setNoDataValues(int idx,
                            Set<Object> noDataValues)
Sets the values, which are interpreted as "No Data".

Specified by:
setNoDataValues in interface FeatureChartStyle
Parameters:
idx - attribute index the "No Data" values are set for
noDataValues - the "No Data" values

getNoDataValues

public Set<Object> getNoDataValues(int idx)
Returns the values, which are interpreted as "No Data".

Specified by:
getNoDataValues in interface FeatureChartStyle
Parameters:
idx - attribute index the "No Data" values are returned for

addNoDataValue

public void addNoDataValue(int idx,
                           Object noDataValue)
Sets a value, which is interpreted as "No Data".

Specified by:
addNoDataValue in interface FeatureChartStyle
Parameters:
idx - attribute index the "No Data" value is set for
noDataValue - the "No Data" value

removeNoDataValue

public boolean removeNoDataValue(int idx,
                                 Object noDataValue)
Removes a "No Data" value for an attribute.

Specified by:
removeNoDataValue in interface FeatureChartStyle
Parameters:
idx - attribute index the "No Data" value is removed for
noDataValue - the "No Data" value to remove
Returns:
false if the value was not an "No Data" value

isNoDataValue

public boolean isNoDataValue(int idx,
                             Object value)
Checks whether the given value is one of the "No data" values for the attribute.

Specified by:
isNoDataValue in interface FeatureChartStyle
Parameters:
idx - attribute index the "No Data" value is checked for
value - an attribute value

filterNoDataValue

public <T> T filterNoDataValue(int idx,
                               T value)
Checks whether the given value is one of the "No data" values for the attribute. In this case this method returns null, otherwise the value itself.

Specified by:
filterNoDataValue in interface FeatureChartStyle
Parameters:
idx - attribute index the "No Data" value is checked for
value - an attribute value
Returns:
null if the given value is one of the "No data" values

applyToFeatureCollection

public JFreeChart applyToFeatureCollection(FeatureCollection fc)
Creates an appropriate Dataset for the attributes defined by this style (according to the attributes types in the given FeatureCollection) and calls BasicChartStyle.applyToDataset(Dataset).

Specified by:
applyToFeatureCollection in interface FeatureChartStyle
Parameters:
fc - a feature collection