lt.monarch.chart
Class AbstractChartSeries<Tags extends AbstractPaintTags,ChartProjector extends Projector>

java.lang.Object
  extended by lt.monarch.chart.engine.AbstractChartObject<Tags>
      extended by lt.monarch.chart.AbstractChartSeries<Tags,ChartProjector>
All Implemented Interfaces:
java.io.Serializable, ChartEntity, ChartObject, ChartSeries, StyleEditorEntity
Direct Known Subclasses:
AbstractChartSeriesEx, BoxWhiskerSeries, ContourSeries, MarkerDecorableSeries, MarkerDecorableSeries3D, Pie3DSeries, PieSeries, SupplementalPieSeries, Surface3DSeries, SurfaceSeries

public abstract class AbstractChartSeries<Tags extends AbstractPaintTags,ChartProjector extends Projector>
extends AbstractChartObject<Tags>
implements ChartSeries

Base implementation for all chart series, which use a ChartDataModel for data input. Manages automatic registration and unregistration of data model listeners.

See Also:
Serialized Form

Field Summary
Modifier and Type Field and Description
protected  MetaDataModel metaModel
          Meta data model
protected  DataModel model
          Data model
protected  AbstractModelValidator modelValidator
          Data model validator
protected  java.lang.String seriesName
          String representing series name
protected  Transformation seriesTransform
           
protected  boolean showLegend
          Boolean value if to show legend
protected  boolean showNullValues
          Boolean value if to show null values
protected  LegendSymbol symbol
           
protected  AxisMapper xMapper
          X axis mapper
protected  AxisMapper yMapper
          Y axis mapper
protected  AxisMapper zMapper
          Z axis mapper
 
Fields inherited from class lt.monarch.chart.engine.AbstractChartObject
AXIS_SORT_POSITION, BREAK_LINE_POSITION, DEFAULT_SORT_POSITION, GRID_SORT_POSITION, MARKER_SERIES_SORT_POSITION, MARKERS_SORT_POSITION, paintStyle, SERIES_SORT_POSITION, sortPosition, style
 
Constructor Summary
Constructor and Description
AbstractChartSeries()
          Sole constructor.
AbstractChartSeries(DataModel model)
          Sole constructor.
AbstractChartSeries(DataModel model, MetaDataModel metaModel)
           
 
Method Summary
Modifier and Type Method and Description
protected  void activate()
          Activates this chart series.
protected  void checkDataModelRequirements(DataModel dataModel)
          Checks if a data model contains all required columns.
 LegendEntry[] createLegendEntries()
          Creates legend entries for the series.
 LegendEntry createLegendEntry()
          Creates legend entry for this chart series.
 LegendSymbol createLegendSymbol()
          Creates legend entry symbol for the series.
protected  void deactivate()
          Deactivates this chart series.
 void draw(AbstractGraphics g)
          Renders chart object on the Graphics context.
 void fillEntitySheet(java.util.Properties id)
          Fills in the property sheet of the chart series.
 Rectangle2D getChartObjectBounds()
          Gets bounds of chart object
 DataModel getDataModel()
          Returns chart series data model.
 java.lang.String getDescription()
          Returns a textual description of the chart series.
abstract  java.lang.Object getMaxValue(DataColumnType valType)
          Note: internal use only! Gets maximum value that is used by series to fit into the chart
 MetaDataModel getMetaDataModel()
          Gets meta data model
abstract  java.lang.Object getMinValue(DataColumnType valType)
          Note: internal use only! Gets minimum value that is used by series to fit into the chart
 AbstractModelValidator getModelValidator()
          Gets model validator
 java.lang.String getName()
          Gets chart series name.
 ChartEntity getNearestChildEntity(java.awt.Point p)
          Finds series entity nearest to the specified point.
 ChartEntity getParentEntity()
          Gets parent chart entity.
 ChartProjector getProjector()
          Returns modified projector.
protected  java.awt.Color getSeriesColor()
          Returns series color from default palette.
 java.lang.String getShortDescription()
          Returns a short textual description of the chart series.
 boolean getShowNullValues()
          Returns true if this component shows (accounts for) null values.
 int getSortPosition()
          Returns chart object paint order index.
 AxisMapper getXMapper()
          Gets xMapper object.
 AxisMapper getYMapper()
          Gets yMapper object.
 AxisMapper getZMapper()
          Gets zMapper object.
protected  void handleDataModelChangeEvent(DataModelChangeEvent ev)
          Handles data model change event.
 void setLegendSymbol(LegendSymbol legendSymbol)
          Sets symbol to use for representing series in legend.
 void setName(java.lang.String name)
          Sets chart series name.
 void setShowNullValues(boolean show)
          Sets the property indicating whether this component shows the data series null values.
 void setValidateData(boolean validate)
          Sets whether to validate model data
 void showLegend(boolean show)
          Specifies whether legend entry for this chart series should be displayed.
protected  void updateClippingToProjector(AbstractGraphics g)
           
 
Methods inherited from class lt.monarch.chart.engine.AbstractChartObject
chart, copy, dispose, finalize, getChart, getPaintStyle, getParent, getStyle, getStyle, invalidate, isVisible, layout, repaint, repaint, setChart, setVisible
 
Methods inherited from class java.lang.Object
clone, equals, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 
Methods inherited from interface lt.monarch.chart.engine.ChartObject
dispose, getChart, getStyle, getStyle, invalidate, isVisible, layout, repaint, repaint, setChart
 
Methods inherited from interface lt.monarch.chart.engine.StyleEditorEntity
getParent, getStyle
 

Field Detail

model

protected final DataModel model
Data model


metaModel

protected MetaDataModel metaModel
Meta data model


seriesName

protected java.lang.String seriesName
String representing series name


showLegend

protected boolean showLegend
Boolean value if to show legend


showNullValues

protected boolean showNullValues
Boolean value if to show null values


symbol

protected LegendSymbol symbol

xMapper

protected AxisMapper xMapper
X axis mapper


yMapper

protected AxisMapper yMapper
Y axis mapper


zMapper

protected AxisMapper zMapper
Z axis mapper


modelValidator

protected AbstractModelValidator modelValidator
Data model validator


seriesTransform

protected Transformation seriesTransform
Constructor Detail

AbstractChartSeries

public AbstractChartSeries()
Sole constructor. (For invocation by subclass constructors).


AbstractChartSeries

public AbstractChartSeries(DataModel model)
Sole constructor. (For invocation by subclass constructors). Constructs chart series with specified data model.

Parameters:
model - chart series data model

AbstractChartSeries

public AbstractChartSeries(DataModel model,
                           MetaDataModel metaModel)
Parameters:
model -
metaModel -
Method Detail

getSortPosition

public int getSortPosition()
Description copied from interface: ChartObject
Returns chart object paint order index.

Specified by:
getSortPosition in interface ChartObject
Overrides:
getSortPosition in class AbstractChartObject<Tags extends AbstractPaintTags>
Returns:
object paint order index

getDataModel

public DataModel getDataModel()
Returns chart series data model.

Returns:
chart series data model

draw

public void draw(AbstractGraphics g)
Description copied from interface: ChartObject
Renders chart object on the Graphics context.

Specified by:
draw in interface ChartObject
Parameters:
g - graphics context

updateClippingToProjector

protected void updateClippingToProjector(AbstractGraphics g)

handleDataModelChangeEvent

protected void handleDataModelChangeEvent(DataModelChangeEvent ev)
Handles data model change event. Called when DataModelChangeEvent is received. Calls repaint() method.

Parameters:
ev - the chart data model change event
See Also:
DataModelChangeEvent

activate

protected void activate()
Activates this chart series. Registers data model listener to receive notifications when data model changes.

Overrides:
activate in class AbstractChartObject<Tags extends AbstractPaintTags>

deactivate

protected void deactivate()
Deactivates this chart series. Unregisters data model listener to no longer receive notifications when data model changes.

Overrides:
deactivate in class AbstractChartObject<Tags extends AbstractPaintTags>

setName

public void setName(java.lang.String name)
Sets chart series name.

Specified by:
setName in interface ChartSeries
Parameters:
name - chart series name

getName

public java.lang.String getName()
Gets chart series name.

Specified by:
getName in interface ChartSeries
Returns:
chart series name

getDescription

public java.lang.String getDescription()
Returns a textual description of the chart series.

Specified by:
getDescription in interface ChartEntity
Returns:
description text
See Also:
ChartEntity.getDescription()

getShortDescription

public java.lang.String getShortDescription()
Returns a short textual description of the chart series.

Specified by:
getShortDescription in interface ChartEntity
Returns:
a short textual description
See Also:
ChartEntity.getShortDescription()

getParentEntity

public ChartEntity getParentEntity()
Gets parent chart entity. Actually returns the same as chart().

Specified by:
getParentEntity in interface ChartEntity
Returns:
parent chart entity

fillEntitySheet

public void fillEntitySheet(java.util.Properties id)
Fills in the property sheet of the chart series.

Specified by:
fillEntitySheet in interface ChartEntity
Parameters:
id - property sheet

createLegendSymbol

public LegendSymbol createLegendSymbol()
Creates legend entry symbol for the series. The symbol has the same entityStyle the local stylesheet does, so updating the series stylesheet updates the legend symbol automatically. Subclasses of the class must override this method.

Returns:
legend symbol
See Also:
LegendSymbol

createLegendEntry

public LegendEntry createLegendEntry()
Creates legend entry for this chart series.

Specified by:
createLegendEntry in interface ChartSeries
Returns:
legend entry for this chart series

createLegendEntries

public LegendEntry[] createLegendEntries()
Creates legend entries for the series.

Specified by:
createLegendEntries in interface ChartSeries
Returns:
legend entries

showLegend

public void showLegend(boolean show)
Specifies whether legend entry for this chart series should be displayed.

Parameters:
show - true, if legend entry for this chart series should be displayed; false otherwise

setShowNullValues

public void setShowNullValues(boolean show)
Sets the property indicating whether this component shows the data series null values.

Parameters:
show - true if null values are displayed and false if they are ignored (filtered).

getShowNullValues

public boolean getShowNullValues()
Returns true if this component shows (accounts for) null values. Null values are not actually displayed, but the space and position is calculated on the axis accordingly as if they of zero value.

Returns:
boolean true if null values are displayed and false if they are ignored (filtered).

getSeriesColor

protected java.awt.Color getSeriesColor()
Returns series color from default palette.

Returns:
color from default palette

getNearestChildEntity

public ChartEntity getNearestChildEntity(java.awt.Point p)
Finds series entity nearest to the specified point.

Parameters:
p - point to search series entity at
Returns:
null, chart series should override to return other value

setLegendSymbol

public void setLegendSymbol(LegendSymbol legendSymbol)
Sets symbol to use for representing series in legend.

Parameters:
legendSymbol - symbol implementation.

getYMapper

public AxisMapper getYMapper()
Gets yMapper object.

Returns:
Returns the yMapper.

getXMapper

public AxisMapper getXMapper()
Gets xMapper object.

Returns:
Returns the xMapper.

getZMapper

public AxisMapper getZMapper()
Gets zMapper object.

Returns:
Returns the zMapper.

getProjector

public ChartProjector getProjector()
Returns modified projector.

Returns:
projector

getMetaDataModel

public MetaDataModel getMetaDataModel()
Gets meta data model

Returns:
the meta data model

getModelValidator

public AbstractModelValidator getModelValidator()
Gets model validator

Returns:
the model validator

setValidateData

public void setValidateData(boolean validate)
Sets whether to validate model data

Parameters:
validate - true if to validate data

getMaxValue

public abstract java.lang.Object getMaxValue(DataColumnType valType)
Note: internal use only! Gets maximum value that is used by series to fit into the chart

Parameters:
valType - data value column
Returns:
maximum value needed

getMinValue

public abstract java.lang.Object getMinValue(DataColumnType valType)
Note: internal use only! Gets minimum value that is used by series to fit into the chart

Parameters:
valType - data value column
Returns:
minimum value needed

checkDataModelRequirements

protected void checkDataModelRequirements(DataModel dataModel)
                                   throws MissingColumnException
Checks if a data model contains all required columns. KEY and VALUE columns are mandatory for all series.

Throws:
MissingColumnException

getChartObjectBounds

public Rectangle2D getChartObjectBounds()
Description copied from interface: StyleEditorEntity
Gets bounds of chart object

Specified by:
getChartObjectBounds in interface StyleEditorEntity
Overrides:
getChartObjectBounds in class AbstractChartObject<Tags extends AbstractPaintTags>
Returns:
A rectangle indicating this chart object bounds