de.erichseifert.gral.data.statistics
Class Histogram1D

java.lang.Object
  extended by de.erichseifert.gral.data.AbstractDataSource
      extended by de.erichseifert.gral.data.statistics.Histogram
          extended by de.erichseifert.gral.data.statistics.Histogram1D
All Implemented Interfaces:
DataListener, DataSource, Iterable<Number>

public class Histogram1D
extends Histogram

View that aggregates the column values of an other data source into a histogram with cells. The cells size can be equally sized by defining a number of cells or breakpoints between histogram cells can be passed as an array to create unequally sized cells.

For ease of use the histogram is a data source itself.


Constructor Summary
Histogram1D(DataSource data, Orientation orientation, int breakCount)
          Creates a new Histogram object with the specified DataSource and cell count.
Histogram1D(DataSource data, Orientation orientation, Number[]... breaks)
          Initializes a new histogram with the specified data source and subdivisions at the specified positions.
 
Method Summary
 Number get(int col, int row)
          Returns the row with the specified index.
 Number[] getCellLimits(int col, int cell)
          Returns the minimum and maximum value of the specified cell.
 int getColumnCount()
          Returns the number of columns of the data source.
 Orientation getOrientation()
          Returns the direction in which the histogram values will be accumulated.
 int getRowCount()
          Returns the number of rows of the data source.
 
Methods inherited from class de.erichseifert.gral.data.statistics.Histogram
dataChanged, getData
 
Methods inherited from class de.erichseifert.gral.data.AbstractDataSource
addDataListener, getColumn, getRow, getStatistics, iterator, removeDataListener
 
Methods inherited from class java.lang.Object
equals, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Constructor Detail

Histogram1D

public Histogram1D(DataSource data,
                   Orientation orientation,
                   int breakCount)
Creates a new Histogram object with the specified DataSource and cell count.

Parameters:
data - DataSource so be analyzed.
orientation - Orientation of the histogram values.
breakCount - Number of subdivisions for analysis.

Histogram1D

public Histogram1D(DataSource data,
                   Orientation orientation,
                   Number[]... breaks)
Initializes a new histogram with the specified data source and subdivisions at the specified positions.

Parameters:
data - Data source to be analyzed.
orientation - Orientation in which the data should be sampled.
breaks - Values of where a subdivision should occur.
Method Detail

getOrientation

public Orientation getOrientation()
Returns the direction in which the histogram values will be accumulated.

Returns:
Horizontal or vertical orientation.

getCellLimits

public Number[] getCellLimits(int col,
                              int cell)
Returns the minimum and maximum value of the specified cell.

Parameters:
col - Column index.
cell - Cell index.
Returns:
Extent of the cell.

get

public Number get(int col,
                  int row)
Description copied from interface: DataSource
Returns the row with the specified index.

Parameters:
col - index of the column to return
row - index of the row to return
Returns:
the specified value of the data cell

getRowCount

public int getRowCount()
Description copied from interface: DataSource
Returns the number of rows of the data source.

Returns:
number of rows in the data source.

getColumnCount

public int getColumnCount()
Description copied from interface: DataSource
Returns the number of columns of the data source.

Returns:
number of columns in the data source.


Copyright © 2009-2010. All Rights Reserved.