umontreal.iro.lecuyer.charts
Class HistogramChart
- java.lang.Object
-
- umontreal.iro.lecuyer.charts.XYChart
-
- umontreal.iro.lecuyer.charts.HistogramChart
-
public class HistogramChart extends XYChart
This class provides tools to create and manage histograms. TheHistogramChartclass is the simplest way to produce histograms. EachHistogramChartobject is linked with anHistogramSeriesCollectiondataset.
-
-
Constructor Summary
Constructors Constructor and Description HistogramChart()Initializes a new HistogramChart instance with an empty data set.HistogramChart(java.lang.String title, java.lang.String XLabel, java.lang.String YLabel, CustomHistogramDataset data)Initializes a new HistogramChart instance with data data.HistogramChart(java.lang.String title, java.lang.String XLabel, java.lang.String YLabel, double[]... data)Initializes a new HistogramChart instance with input data.HistogramChart(java.lang.String title, java.lang.String XLabel, java.lang.String YLabel, double[] data, int numPoints)Initializes a new HistogramChart instance with input data.HistogramChart(java.lang.String title, java.lang.String XLabel, java.lang.String YLabel, DoubleArrayList... data)Initializes a new HistogramChart instance with data data.HistogramChart(java.lang.String title, java.lang.String XLabel, java.lang.String YLabel, int[] count, double[] bound)Initializes a new HistogramChart instance with data count and bound.HistogramChart(java.lang.String title, java.lang.String XLabel, java.lang.String YLabel, TallyStore... tallies)Initializes a new HistogramChart instance with data arrays contained in eachTallyStoreobject.
-
Method Summary
All Methods Instance Methods Concrete Methods Modifier and Type Method and Description HistogramSeriesCollectiongetSeriesCollection()Returns the chart's dataset.voidsetAutoRange(boolean right, boolean top)The x and the y ranges of the chart are set automatically.voidsetManuelRange(double[] range, boolean right, boolean top)voidsetSeriesCollection(HistogramSeriesCollection dataset)Links a new dataset to the current chart.voidsetTicksSynchro(int s)Synchronizes x-axis ticks to the s-th histogram bins.java.lang.StringtoLatex(double width, double height)Exports the chart to a LATEX source code using PGF/TikZ.javax.swing.JFrameview(int width, int height)Displays chart on the screen using Swing.-
Methods inherited from class umontreal.iro.lecuyer.charts.XYChart
disableGrid, enableGrid, getChartMargin, getJFreeChart, getTitle, getXAxis, getYAxis, setAutoRange, setAutoRange00, setChartMargin, setLatexDocFlag, setManualRange, setManualRange, setManualRange00, setprobFlag, setTitle, toLatexFile
-
-
-
-
Constructor Detail
-
HistogramChart
public HistogramChart()
Initializes a new HistogramChart instance with an empty data set.
-
HistogramChart
public HistogramChart(java.lang.String title, java.lang.String XLabel, java.lang.String YLabel, double[]... data)Initializes a new HistogramChart instance with input data. title is a title, XLabel is a short description of the x-axis, and YLabel a short description of the y-axis. The input parameter data represents a collection of observation sets. Therefore data [i], i = 0,…, n - 1, is used to plot the ith histogram.- Parameters:
title- chart title.XLabel- Label on x-axis.YLabel- Label on y-axis.data- series of point sets.
-
HistogramChart
public HistogramChart(java.lang.String title, java.lang.String XLabel, java.lang.String YLabel, double[] data, int numPoints)Initializes a new HistogramChart instance with input data. title is a title, XLabel is a short description of the x-axis, and YLabel a short description of the y-axis. The input parameter data represents an observation set. Only the first numPoints of data will be considered to plot the histogram.- Parameters:
title- chart title.XLabel- Label on x-axis.YLabel- Label on y-axis.data- series of point sets.numPoints- Number of points to plot
-
HistogramChart
public HistogramChart(java.lang.String title, java.lang.String XLabel, java.lang.String YLabel, DoubleArrayList... data)Initializes a new HistogramChart instance with data data. Each DoubleArrayList input parameter represents a collection of observation sets.DoubleArrayListis from the Colt library and is used to store data.- Parameters:
title- chart title.XLabel- Label on x-axis.YLabel- Label on y-axis.data- series of observation sets.
-
HistogramChart
public HistogramChart(java.lang.String title, java.lang.String XLabel, java.lang.String YLabel, TallyStore... tallies)Initializes a new HistogramChart instance with data arrays contained in eachTallyStoreobject. The input parameter tallies represents a collection of observation sets.- Parameters:
title- chart title.XLabel- Label on x-axis.YLabel- Label on y-axis.tallies- series of observation sets.
-
HistogramChart
public HistogramChart(java.lang.String title, java.lang.String XLabel, java.lang.String YLabel, CustomHistogramDataset data)Initializes a new HistogramChart instance with data data. The input parameter data represents a set of plotting data.CustomHistogramDatasetis a JFreeChart-like container class that stores and manages observation sets.- Parameters:
title- chart title.XLabel- Label on x-axis.YLabel- Label on y-axis.data- series collection.
-
HistogramChart
public HistogramChart(java.lang.String title, java.lang.String XLabel, java.lang.String YLabel, int[] count, double[] bound)Initializes a new HistogramChart instance with data count and bound. The adjacent categories (or bins) are specified as non-overlapping intervals: bin[j] contains the values in the interval [bound[j], bound[j+1]], and count[j] is the number of such values. Thus the length of bound must be equal to the length of count plus one: the last value of bound is the right boundary of the last bin.- Parameters:
title- chart title.XLabel- Label on x-axis.YLabel- Label on y-axis.count- the number of observation between each bound.bound- the bounds of the observations
-
-
Method Detail
-
setAutoRange
public void setAutoRange(boolean right, boolean top)Description copied from class:XYChartThe x and the y ranges of the chart are set automatically. If right is true, the vertical axis will be on the left of the points, otherwise on the right. If top is true, the horizontal axis will be under the points, otherwise above the points.- Overrides:
setAutoRangein classXYChart- Parameters:
right- true if the x-values on the right of axis.top- true if the y-values on the top of axis.
-
setManuelRange
public void setManuelRange(double[] range, boolean right, boolean top)
-
getSeriesCollection
public HistogramSeriesCollection getSeriesCollection()
Returns the chart's dataset.- Returns:
- the chart's dataset.
-
setSeriesCollection
public void setSeriesCollection(HistogramSeriesCollection dataset)
Links a new dataset to the current chart.- Parameters:
dataset- new dataset.
-
setTicksSynchro
public void setTicksSynchro(int s)
Synchronizes x-axis ticks to the s-th histogram bins.- Specified by:
setTicksSynchroin classXYChart- Parameters:
s- selects histogram used to define ticks.
-
view
public javax.swing.JFrame view(int width, int height)Displays chart on the screen using Swing. This method creates an application containing a chart panel displaying the chart. The created frame is positioned on-screen, and displayed before it is returned. The width and the height of the chart are measured in pixels.
-
toLatex
public java.lang.String toLatex(double width, double height)Description copied from class:XYChartExports the chart to a LATEX source code using PGF/TikZ. This method constructs and returns a string that can be written to a LATEX document to render the plot. width and height represents the width and the height of the produced chart. These dimensions do not take into account the axes and labels extra space. The width and the height of the chart are measured in centimeters.
-
-
DMelt 3.0 © DataMelt by jWork.ORG