Orbital library

orbital.awt
Class ChartModel

java.lang.Object
  extended by orbital.awt.ChartModel
All Implemented Interfaces:
java.io.Serializable

public class ChartModel
extends java.lang.Object
implements java.io.Serializable

Containement class that represents a model for chart data.

Graphs in the chart data are objects like, for example:

Each graph can have associated an attribute-map that specifies attributes for displaying it. Which keys are recognized and which types of graphs are expected is specific to the View of this Model.

Author:
André Platzer
See Also:
Serialized Form
Structure:
aggregate graphs:java.util.List unidirectional, aggregate range:Range n-sized unidirectional, aggregate scale:Vector n-sized unidirectional

Nested Class Summary
 class ChartModel.Entry
          The entries of a ChartModel's List of displayed graphs.
 
Constructor Summary
ChartModel()
           
 
Method Summary
 void add(java.lang.Object graph)
          Add a new graph to be displayed without attributes.
 void add(java.lang.Object graph, java.util.Map attributes)
          Add a new graph to be displayed.
 void addPropertyChangeListener(java.beans.PropertyChangeListener listener)
           
 void addPropertyChangeListener(java.lang.String propertyName, java.beans.PropertyChangeListener listener)
           
 java.util.List attributeList()
          Get the List of solely attributes to be displayed.
 int getGraphCount()
          Get the number of graphs displayed.
 java.util.List getGraphs()
          Get the List of graphs to be displayed.
 Range getRange()
          Get the visible range to be displayed.
 Vector getScale()
          Get the scale.
 java.util.List graphList()
          Get the List of solely graphs to be displayed.
 boolean isRainbow()
          Whether rainbow colors are used for graphs that have no color setting.
 java.util.Iterator iterator()
          Returns an iterator over the elements in this chart model in proper sequence.
 void remove(int index)
          Remove a graph.
 void removeAll()
          Remove all graphs.
 void removePropertyChangeListener(java.beans.PropertyChangeListener listener)
           
 void removePropertyChangeListener(java.lang.String propertyName, java.beans.PropertyChangeListener listener)
           
 void setAutoScaling()
          Sets the scale and range parameters automatically, according to the graphs displayed.
 void setRainbow(boolean rainbowize)
          Set rainbow colors for all graphs added to display.
 void setRange(Range range)
          Set the visible range to be displayed.
 void setScale(Vector scale)
          Set the scale.
 void setScaleMarks(double marks)
          Set the scale such that at least a specified number of marks is visible on each axis.
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Constructor Detail

ChartModel

public ChartModel()
Method Detail

getGraphCount

public int getGraphCount()
Get the number of graphs displayed.


getGraphs

public java.util.List getGraphs()
Get the List of graphs to be displayed. This list contains objects of kind ChartModel.Entry.

See Also:
graphList(), attributeList()

iterator

public java.util.Iterator iterator()
Returns an iterator over the elements in this chart model in proper sequence.

Returns:
an iterator over the elements in this chart model in proper sequence.

getScale

public Vector getScale()
Get the scale. On the axisi, marks will be placed with distance scalei.


setScale

public void setScale(Vector scale)
Set the scale. On the axisi, marks will be placed with distance scalei.


setScaleMarks

public void setScaleMarks(double marks)
Set the scale such that at least a specified number of marks is visible on each axis.


getRange

public Range getRange()
Get the visible range to be displayed.


setRange

public void setRange(Range range)
Set the visible range to be displayed.


isRainbow

public boolean isRainbow()
Whether rainbow colors are used for graphs that have no color setting.


setRainbow

public void setRainbow(boolean rainbowize)
Set rainbow colors for all graphs added to display. A new color will be chosen for each graph added except if its color is explicitly specified in the attributes.

See Also:
nextRainbowColor()

addPropertyChangeListener

public void addPropertyChangeListener(java.beans.PropertyChangeListener listener)

removePropertyChangeListener

public void removePropertyChangeListener(java.beans.PropertyChangeListener listener)

addPropertyChangeListener

public void addPropertyChangeListener(java.lang.String propertyName,
                                      java.beans.PropertyChangeListener listener)

removePropertyChangeListener

public void removePropertyChangeListener(java.lang.String propertyName,
                                         java.beans.PropertyChangeListener listener)

add

public void add(java.lang.Object graph,
                java.util.Map attributes)
Add a new graph to be displayed. Attributes for displaying this graph are contained in the associated Map.

Parameters:
graph - the graph to be displayed in the chart.
attributes - map of attributes how graph should be displayed. Use null if for no attributes.

add

public void add(java.lang.Object graph)
Add a new graph to be displayed without attributes.


remove

public void remove(int index)
Remove a graph.


removeAll

public void removeAll()
Remove all graphs.


graphList

public java.util.List graphList()
Get the List of solely graphs to be displayed. This list contains objects of kind Object. Unlike getGraphs(), no ChartModel.Entry objects are returned, but only the ChartModel.Entry.graph part.

See Also:
getGraphs()

attributeList

public java.util.List attributeList()
Get the List of solely attributes to be displayed. This list contains objects of kind Map. Unlike getGraphs(), no ChartModel.Entry objects are returned. but only the ChartModel.Entry.attributes part.

See Also:
getGraphs()

setAutoScaling

public void setAutoScaling()
Sets the scale and range parameters automatically, according to the graphs displayed.

The range is determined by the minima / maxima and the scale is set to default.


Orbital library
1.3.0: 11 Apr 2009

Copyright © 1996-2009 André Platzer
All Rights Reserved.