ChartCat 1.2

li.netcat.chart.util
Class GraphPart

java.lang.Object
  extended byli.netcat.chart.util.AbstractPart
      extended byli.netcat.chart.util.GraphPart
All Implemented Interfaces:
Part
Direct Known Subclasses:
CartesianGraphPart, PolarGraphPart

public abstract class GraphPart
extends AbstractPart

Abstract super class of all parts that paint a graph. This class is the owner of the GraphLook and the ChartModel. As the following figure shows, several other models are derived from the ChartModel:

During the construction phase, this GraphPart crates a new and empty ChartModel. It also allocates default implementations of all derived models and connects them to the ChartModel. The following list clarifies the purpose of these models:

All models can be replaced by custom implementations after the construction.

Author:
Arthur Marxer

Field Summary
static int STACK_STRATEGY_APPEND
          Equal to ChartConstants.STACK_STRATEGY_APPEND
static int STACK_STRATEGY_GROUP
          Equal to ChartConstants.STACK_STRATEGY_GROUP
static int STACK_TYPE_NOT_STACKED
          Equal to ChartConstants.STACK_TYPE_NOT_STACKED
static int STACK_TYPE_STACKED
          Equal to ChartConstants.STACK_TYPE_STACKED
static int STACK_TYPE_STACKED_PERCENT
          Equal to ChartConstants.STACK_TYPE_STACKED_PERCENT
 
Fields inherited from class li.netcat.chart.util.AbstractPart
BACKGROUND, FOREGROUND, PERSPECTIVE
 
Constructor Summary
GraphPart(int stackType, int stackStrategy, boolean centered)
          Constructs a new GraphPart and uses the given parameters to allocate the default models.
 
Method Summary
 ChartModel getChartModel()
          Returns the current chart model.
protected  float getDiscreetLength()
          Utility method for subclasses that returns the length of the discreet scale model.
 ScaleModel getDiscreetScaleModel()
          Returns the discreet scale model.
 GraphLook getGraphLook()
          Returns the look of the graph.
 LegendModel getLegendModel()
          Returns the current legend model.
protected  float getNumericLength()
          Utility method for subclasses that returns the length of the numeric scale model.
 NumericScaleModel getNumericScaleModel()
          Returns the numeric scale model.
 StackModel getStackModel()
          Returns the current installed stack model.
abstract  ValueLocation getValueLocation(int rowIndex, int columnIndex)
          Abstract function that calculates a ValueLocation for a given cell.
 void setChartModel(ChartModel chartModel)
          Sets the chart model that provides all dynamic data.
protected  void setDiscreetLength(float length)
          Utility method for subclasses to set the length of the discreet scale model.
 void setDiscreetScaleModel(ScaleModel discreetScaleModel)
          Sets a new instance of the discreet scale model.
 void setGraphLook(GraphLook graphLook)
          Sets the look of the graph.
 void setLegendModel(LegendModel legendModel)
          Sets a new legend model.
protected  void setNumericLength(float length)
          Utility method for subclasses to set the length of the numeric scale model.
 void setNumericScaleModel(NumericScaleModel numericScaleModel)
          Sets a new instance of the numeric scale model.
 void setStackModel(StackModel stackModel)
          Sets a new stack model.
 
Methods inherited from class li.netcat.chart.util.AbstractPart
getChart, getPerspective, invalidate, setChart, setPerspective
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 
Methods inherited from interface li.netcat.chart.Part
getLayout
 

Field Detail

STACK_TYPE_NOT_STACKED

public static final int STACK_TYPE_NOT_STACKED
Equal to ChartConstants.STACK_TYPE_NOT_STACKED

See Also:
Constant Field Values

STACK_TYPE_STACKED

public static final int STACK_TYPE_STACKED
Equal to ChartConstants.STACK_TYPE_STACKED

See Also:
Constant Field Values

STACK_TYPE_STACKED_PERCENT

public static final int STACK_TYPE_STACKED_PERCENT
Equal to ChartConstants.STACK_TYPE_STACKED_PERCENT

See Also:
Constant Field Values

STACK_STRATEGY_APPEND

public static final int STACK_STRATEGY_APPEND
Equal to ChartConstants.STACK_STRATEGY_APPEND

See Also:
Constant Field Values

STACK_STRATEGY_GROUP

public static final int STACK_STRATEGY_GROUP
Equal to ChartConstants.STACK_STRATEGY_GROUP

See Also:
Constant Field Values
Constructor Detail

GraphPart

public GraphPart(int stackType,
                 int stackStrategy,
                 boolean centered)
Constructs a new GraphPart and uses the given parameters to allocate the default models.

Parameters:
stackType - The type of the resulting graph. Specify one of STACK_TYPE_NOT_STACKED, STACK_TYPE_STACKED or STACK_TYPE_STACKED_PERCENT. This parameter is used to initialize an instance of a DefaultStackModel.
stackStrategy - The strategy that is used when stacking negative and positive values. Specify one of STACK_STRATEGY_APPEND or STACK_STRATEGY_GROUP. This parameter is used to initialize an instance of a DefaultStackModel.
centered - This parameter is used to initialize the ScaleModel as an instance of RowScaleModel.
Method Detail

getGraphLook

public GraphLook getGraphLook()
Returns the look of the graph.

Returns:
The look of the graph, it's never null.

setGraphLook

public void setGraphLook(GraphLook graphLook)
Sets the look of the graph.

Parameters:
graphLook - The look of the graph, not null.

getChartModel

public ChartModel getChartModel()
Returns the current chart model.

Returns:
The current chart model, never null.

setChartModel

public void setChartModel(ChartModel chartModel)
Sets the chart model that provides all dynamic data. This method also sets the chart model to all derived models.

Parameters:
chartModel - The chart model. A value of null will be replaced by an empty chart model.

getStackModel

public StackModel getStackModel()
Returns the current installed stack model.

Returns:
The current stack model, never null.

setStackModel

public void setStackModel(StackModel stackModel)
Sets a new stack model. This method also sets the current ChartModel to the new stack model.

Parameters:
stackModel - The new StackModel, not null.

getLegendModel

public LegendModel getLegendModel()
Returns the current legend model.

Returns:
The current legend model, never null.

setLegendModel

public void setLegendModel(LegendModel legendModel)
Sets a new legend model. This method also sets the current ChartModel to the new legend model.

Parameters:
legendModel - The new legend model, not null.

getDiscreetScaleModel

public ScaleModel getDiscreetScaleModel()
Returns the discreet scale model. Modifications made to this instance are not recognized automatically. Help it along by invoking the invalidate() method of this part.

Returns:
The discreet scale model, never null.

setDiscreetScaleModel

public void setDiscreetScaleModel(ScaleModel discreetScaleModel)
Sets a new instance of the discreet scale model. This method also sets the current ChartModel to the new scale model.

Parameters:
discreetScaleModel - The new discreet scale model, not null.

getNumericScaleModel

public NumericScaleModel getNumericScaleModel()
Returns the numeric scale model. Modifications made to this instance are not recognized automatically. Help it along by invoking the invalidate() method of this part.

Returns:
The numeric scale model, never null.

setNumericScaleModel

public void setNumericScaleModel(NumericScaleModel numericScaleModel)
Sets a new instance of the numeric scale model. This method also sets the current ChartModel to the new scale model.

Parameters:
numericScaleModel - The new numeric scale model, not null.

getValueLocation

public abstract ValueLocation getValueLocation(int rowIndex,
                                               int columnIndex)
Abstract function that calculates a ValueLocation for a given cell.

Parameters:
rowIndex - The index of the row. It must lie in a valid range of the current stack model.
columnIndex - The index of the column. It must lie in a valid range of the current stack model.
Returns:
The ValueLocation for the given cell or null if not available.

getDiscreetLength

protected float getDiscreetLength()
Utility method for subclasses that returns the length of the discreet scale model.

Returns:
The length of the discreet scale model.

setDiscreetLength

protected void setDiscreetLength(float length)
Utility method for subclasses to set the length of the discreet scale model.

Returns:
The length of the discreet scale model, typically >= 1.0f.

getNumericLength

protected float getNumericLength()
Utility method for subclasses that returns the length of the numeric scale model.

Returns:
The length of the numeric scale model.

setNumericLength

protected void setNumericLength(float length)
Utility method for subclasses to set the length of the numeric scale model.

Returns:
The length of the numeric scale model, typically >= 1.0f.

ChartCat 1.2

Copyright © 2003 - 2005 NetCat Inc.. All rights reserved. Feedback

Chart,Charting,Charts,Java,Java Chart,Java Charting,Java Charts,Chart Java,Charts Java,3D,3D Chart,3Dchart,Graph,Graphs,Chart Graph,Java Graph,Diagram,Diagrams,Java Diagram,Java Diagrams,Curve,Curves,Bar Chart,Pie Chart,Line Chart,Area Chart,Bar Graph,Pie Graph,Line Graph,Java Diagram,Chart Diagram,Package,Library,Chart Library,Chart Engine,Chart Package,Graph Package,Paint,Support,Graphic,Graphics,Print, Chart,Charting,Charts,Java,Java Chart,Java Charting,Java Charts,Chart Java,Charts Java,3D,3D Chart,3Dchart,Graph,Graphs,Chart Graph,Java Graph,Diagram,Diagrams,Java Diagram,Java Diagrams,Curve,Curves,Bar Chart,Pie Chart,Line Chart,Area Chart,Bar Graph,Pie Graph,Line Graph,Java Diagram,Chart Diagram,Package,Library,Chart Library,Chart Engine,Chart Package,Graph Package,Paint,Support,Graphic,Graphics,Print, Chart,Charting,Charts,Java,Java Chart,Java Charting,Java Charts,Chart Java,Charts Java,3D,3D Chart,3Dchart,Graph,Graphs,Chart Graph,Java Graph,Diagram,Diagrams,Java Diagram,Java Diagrams,Curve,Curves,Bar Chart,Pie Chart,Line Chart,Area Chart,Bar Graph,Pie Graph,Line Graph,Java Diagram,Chart Diagram,Package,Library,Chart Library,Chart Engine,Chart Package,Graph Package,Paint,Support,Graphic,Graphics,Print