org.omegahat.Graphics.Plots
Class DynamicHistogram

java.lang.Object
  |
  +--org.omegahat.Graphics.Primitives.GraphicalObject
        |
        +--org.omegahat.Graphics.Primitives.RGO
              |
              +--org.omegahat.Graphics.Primitives.GraphicalContainer
                    |
                    +--org.omegahat.Graphics.Plots.DataPlot
                          |
                          +--org.omegahat.Graphics.Plots.Histogram
                                |
                                +--org.omegahat.Graphics.Plots.DynamicHistogram
All Implemented Interfaces:
Addable, Copyable, GraphicalComponentInt, GraphicalContainerInt, MathOperable, ScaledComponentInt, SimpleGraphicalContainerInt, Subsettable, Tree

public class DynamicHistogram
extends Histogram

An incrementally updatable version of the basic Histogram to which one can add new values and have them added to the appropriate bin and redraw just that bin. Rescaling, etc. is ignore in this current implementation as there are a variety of different possibilities.


Field Summary
protected  HistogramContentsInt contents
           
 
Fields inherited from class org.omegahat.Graphics.Plots.Histogram
blocks, colors
 
Fields inherited from class org.omegahat.Graphics.Plots.DataPlot
dataRegion, xAxis, xLabel, yAxis, yLabel
 
Fields inherited from class org.omegahat.Graphics.Primitives.GraphicalContainer
allocator, children, origin, parent, scaleX, scaleY
 
Fields inherited from class org.omegahat.Graphics.Primitives.RGO
region
 
Fields inherited from class org.omegahat.Graphics.Primitives.GraphicalObject
ACTIVE, fontSize, lastDevice, lastHeightCM, lastRegion, lastWidthCM, parents, status, VISIBLE
 
Fields inherited from interface org.omegahat.Environment.DataStructures.MathOperable
DIVIDE, MINUS, MULTIPLY, PLUS
 
Constructor Summary
DynamicHistogram(double[] data, java.lang.String name)
          Use the data to define the histogram and the name as its name.
DynamicHistogram(UnivariateSummary summary)
          Use the univariate summary to define the initial histogram.
DynamicHistogram(VariableInt v)
          Use the variable and its name to define the initial histogram.
 
Method Summary
 HistogramBinInt addValue(double val)
           
 GraphicalComponentInt getBar(HistogramBinInt bin)
           
 HistogramContentsInt getContents()
          Accessor for contents field
 HistogramBinInt identifyBin(double value)
          Return the HistogramBinInt that contains the speicified X value.
 int makeBars(HistogramContentsInt contents)
          Extends inherited method by caching the argument for future use.
 HistogramContentsInt setContents(HistogramContentsInt value)
          Accessor for setting contents field
 
Methods inherited from class org.omegahat.Graphics.Plots.Histogram
make, makeBin, makeContents
 
Methods inherited from class org.omegahat.Graphics.Plots.DataPlot
bottomAxis, bottomAxis, createDataRegion, createDataRegion, createDataRegion, createRegionAllocator, dataRegion, getXAxis, getXLabel, getYAxis, getYLabel, leftAxis, leftAxis, make, setXAxis, setXLabel, setYAxis, setYLabel
 
Methods inherited from class org.omegahat.Graphics.Primitives.GraphicalContainer
add, addGraphicalObject, addGraphicalObject, addGraphicalObject, addGraphicalObject, addGraphicalObject, addGraphicalObject, addGraphicalObject, addGraphicalObject, addGraphicalObject, addGraphicalObject, addValue, copy, copy, draw, drawChildren, get, getChild, getChildCount, getChildren, getDevice, getOrigin, getRegionAllocator, getXScale, getYScale, parent, parent, remove, removeGraphicalObject, removeGraphicalObject, setOrigin, setRegionAllocator, setXScale, setYScale, subset, subset, transform, transform
 
Methods inherited from class org.omegahat.Graphics.Primitives.RGO
center, centre, createRegionDescription, createRegionDescription, getRegion, height, height, setHJust, setRegion, setVJust, width, width, x, x, y, y
 
Methods inherited from class org.omegahat.Graphics.Primitives.GraphicalObject
cacheSize, getFontSize, getFontSize, getParameters, getParents, getStatus, isActive, isVisible, lastHeightCM, lastRegion, lastWidthCM, parents, setActive, setParameters, setParents, setVisible
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 
Methods inherited from interface org.omegahat.Graphics.Primitives.GraphicalComponentInt
getParameters, getRegion, isActive, isVisible, parents, setActive, setParameters, setRegion, setVisible
 

Field Detail

contents

protected HistogramContentsInt contents
Constructor Detail

DynamicHistogram

public DynamicHistogram(UnivariateSummary summary)
Use the univariate summary to define the initial histogram.

DynamicHistogram

public DynamicHistogram(double[] data,
                        java.lang.String name)
Use the data to define the histogram and the name as its name.

Works via the UnivariateSummary class; in particular, note that the data will be sorted in place (copy it if you don't want it overwritten).


DynamicHistogram

public DynamicHistogram(VariableInt v)
Use the variable and its name to define the initial histogram.

Currently, the variable must in fact be an instance of the RealVariable class or a subclass. In contrast to the constructor using a raw double array, this constructor copies the data in the variable before constructing the histogram.

Method Detail

addValue

public HistogramBinInt addValue(double val)

makeBars

public int makeBars(HistogramContentsInt contents)
Extends inherited method by caching the argument for future use.
Overrides:
makeBars in class Histogram

identifyBin

public HistogramBinInt identifyBin(double value)
Return the HistogramBinInt that contains the speicified X value.

getBar

public GraphicalComponentInt getBar(HistogramBinInt bin)

getContents

public HistogramContentsInt getContents()
Accessor for contents field

setContents

public HistogramContentsInt setContents(HistogramContentsInt value)
Accessor for setting contents field