public class HistogramModel extends ChartModel
Modifier and Type | Field and Description |
---|---|
static int |
DEFAULT_BINS
The default number of bins.
|
static int |
INITIAL_DATA_SOURCES
Default number of data sources for plot initialization.
|
Constructor and Description |
---|
HistogramModel()
Creates a blank histogram.
|
HistogramModel(int numSources)
Creates a histogram with no data and a specified number of datsets.
|
HistogramModel(int numSources,
int bins) |
HistogramModel(java.util.List<double[]> data,
java.util.List<java.lang.String> dataNames,
int bins)
Creates a histogram with the provided number of bins, data set(s), and
data name(s), but does not include titles for the histogram, the x axis
or the y axis.
|
HistogramModel(java.util.List<double[]> data,
java.util.List<java.lang.String> dataNames,
int bins,
java.lang.String title,
java.lang.String xAxisName,
java.lang.String yAxisName)
Creates a histogram with the provided number of bins, data set(s), data
name(s), title, and x and y axis titles.
|
HistogramModel(java.util.List<double[]> newData,
java.util.List<java.lang.String> dataNames,
int bins,
java.lang.String title,
java.lang.String xAxisName,
java.lang.String yAxisName,
java.awt.Color[] colorPallet)
Creates a histogram with the provided number of bins, data set(s), data
name(s), title, and x and y axis titles.
|
Modifier and Type | Method and Description |
---|---|
void |
addData(double[] histData,
java.lang.Integer index)
Add double array data to a specified data series.
|
void |
addDataSource()
Adds a data source to the chart.
|
void |
addDataSources(int numDataSources)
Create specified number of set of data sources.
|
int |
getBins() |
java.util.List<double[]> |
getData() |
java.util.List<java.lang.String> |
getDataNames() |
org.jfree.data.xy.IntervalXYDataset |
getDataSet() |
java.util.Collection<OverwritableHistogramDataset.ColoredDataSeries> |
getSeriesData()
Return the underlying series data.
|
void |
redraw()
Re-add the data.
|
void |
resetData()
Clears the data.
|
void |
resetData(java.util.List<double[]> data,
java.util.List<java.lang.String> names)
Reset the data in the model.
|
void |
setBins(int bins)
Sets the number of bins.
|
void |
setSeriesColor(java.lang.String name,
java.awt.Color c)
Set the color of a data series.
|
addChartSettingsListener, addListener, fireChartInitialized, fireDataSourceAdded, fireDataSourceRemoved, fireSettingsChanged, getXStream
public static final int DEFAULT_BINS
public static final int INITIAL_DATA_SOURCES
public HistogramModel()
public HistogramModel(int numSources)
numSources
- number of datasets to addpublic HistogramModel(int numSources, int bins)
public HistogramModel(java.util.List<double[]> data, java.util.List<java.lang.String> dataNames, int bins)
data
- the data set(s) to be plotteddataNames
- the name(s) of the data set(s)bins
- the number of bins used in the histogrampublic HistogramModel(java.util.List<double[]> data, java.util.List<java.lang.String> dataNames, int bins, java.lang.String title, java.lang.String xAxisName, java.lang.String yAxisName)
data
- the data set(s) to be plotteddataNames
- the name(s) of the data set(s)bins
- the number of bins used in the histogramtitle
- the title of the histogramxAxisName
- the title of the x axisyAxisName
- the title of the y axispublic HistogramModel(java.util.List<double[]> newData, java.util.List<java.lang.String> dataNames, int bins, java.lang.String title, java.lang.String xAxisName, java.lang.String yAxisName, java.awt.Color[] colorPallet)
newData
- the data set(s) to be plotteddataNames
- the name(s) of the data set(s)bins
- the number of bins used in the histogramtitle
- the title of the histogramxAxisName
- the title of the x axisyAxisName
- the title of the y axiscolorPallet
- a custom color palletepublic void addData(double[] histData, java.lang.Integer index)
index
- data indexhistData
- the data to add at that indexpublic void redraw()
public void resetData(java.util.List<double[]> data, java.util.List<java.lang.String> names)
data
- the data to setnames
- public void resetData()
public void addDataSources(int numDataSources)
numDataSources
- number of data sources to initialize plot withpublic void addDataSource()
public void setBins(int bins)
bins
- the new number of binspublic java.util.List<double[]> getData()
public void setSeriesColor(java.lang.String name, java.awt.Color c)
name
- name of seriesc
- the color to setpublic java.util.Collection<OverwritableHistogramDataset.ColoredDataSeries> getSeriesData()
public java.util.List<java.lang.String> getDataNames()
public int getBins()
public org.jfree.data.xy.IntervalXYDataset getDataSet()