Class AbstractHistogram

    • Field Detail

      • data

        protected final double[] data
      • axisBins

        protected final double[][] axisBins
    • Constructor Detail

      • AbstractHistogram

        public AbstractHistogram​(java.lang.String name,
                                 double[] xBins)
        Creates a non equidistant histogram with name and range [minX, maxX]

        NOTE: since chartfx's default ErrorDataSetRenderer cannot access the bin boundaries, it is currently unable to correctly render non equidistant Histograms.

        Parameters:
        name - of the data sets
        xBins - the bin boundary array (defines [minX, maxX] and nBins)
      • AbstractHistogram

        public AbstractHistogram​(java.lang.String name,
                                 int nBins,
                                 double minX,
                                 double maxX,
                                 AbstractHistogram.HistogramOuterBounds boundsType)
        Creates histogram with name and range [minX, maxX]
        Parameters:
        name - of the data sets
        nBins - number of bins
        minX - minimum of range
        maxX - maximum of range
        boundsType - how the min/max value should be interpreted
      • AbstractHistogram

        public AbstractHistogram​(java.lang.String name,
                                 int nBinsX,
                                 double minX,
                                 double maxX,
                                 int nBinsY,
                                 double minY,
                                 double maxY,
                                 AbstractHistogram.HistogramOuterBounds boundsType)
        Creates 2D histogram with name and ranges [minX, maxX] and [minY, maxY]
        Parameters:
        name - of the data sets
        nBinsX - number of horizontal bins
        minX - minimum of horizontal range
        maxX - maximum of horizontal range
        nBinsY - number of vertical bins
        minY - minimum of vertical range
        maxY - maximum of vertical range
        boundsType - How the min and max value should be interpreted
    • Method Detail

      • addBinContent

        public void addBinContent​(int bin)
        Description copied from interface: Histogram
        Increment bin content by 1. More...
        Specified by:
        addBinContent in interface Histogram
        Parameters:
        bin - global bin ID
      • addBinContent

        public void addBinContent​(int bin,
                                  double w)
        Description copied from interface: Histogram
        Increment bin content by a weight w. More...
        Specified by:
        addBinContent in interface Histogram
        Parameters:
        bin - global bin ID
        w - weight
      • findBin

        public int findBin​(double x,
                           double y)
        Specified by:
        findBin in interface Histogram
        Parameters:
        x - spatial real-valued coordinate in X
        y - spatial real-valued coordinate in Y
        Returns:
        bin index corresponding to spatial x and y coordinates
      • findBin

        public int findBin​(double x,
                           double y,
                           double z)
        Specified by:
        findBin in interface Histogram
        Parameters:
        x - spatial real-valued coordinate in X
        y - spatial real-valued coordinate in Y
        z - spatial real-valued coordinate in Z
        Returns:
        bin index corresponding to spatial x, y and z coordinates
      • findBin

        public int findBin​(int dimIndex,
                           double val)
        Specified by:
        findBin in interface Histogram
        Parameters:
        dimIndex - the dimension index
        val - spatial real-valued coordinate for dimension dimIndex
        Returns:
        bin index corresponding to spatial x and y coordinates
      • findNextLargerIndex

        protected int findNextLargerIndex​(double[] bin,
                                          double value)
      • getBinCenter

        public double getBinCenter​(int dimIndex,
                                   int binIndex)
        Specified by:
        getBinCenter in interface Histogram
        Parameters:
        dimIndex - the dimension index
        binIndex - index
        Returns:
        bin centre for axis with dimIndex
      • getBinCount

        public int getBinCount​(int dimIndex)
        Specified by:
        getBinCount in interface Histogram
        Parameters:
        dimIndex - the dimension index
        Returns:
        the number of bins for the given dimIndex (includes the under- and over-flow bin)
      • getBinContent

        public double getBinContent​(int bin)
        Description copied from interface: Histogram
        Return content of bin number bin. Convention for numbering bins For all histogram types: nbins, xlow, xup bin = 0; underflow bin bin = 1; first bin with low-edge xlow INCLUDED bin = nbins; last bin with upper-edge xup EXCLUDED bin = nbins+1; overflow bin
        Specified by:
        getBinContent in interface Histogram
        Parameters:
        bin - the index
        Returns:
        numeric bin content
      • getDataCount

        public int getDataCount()
        Description copied from interface: DataSet
        Get the number of data points in the data set.
        Specified by:
        getDataCount in interface DataSet
        Returns:
        the number of data points
      • isEquiDistant

        public boolean isEquiDistant()
        Specified by:
        isEquiDistant in interface Histogram
        Returns:
        true if bin sizes are equal
      • getBinLimits

        public double getBinLimits​(int dimIndex,
                                   Histogram.Boundary boundary,
                                   int binIndex)
        Specified by:
        getBinLimits in interface Histogram
        Parameters:
        dimIndex - the dimension index
        boundary - for upper or lower bound limits
        binIndex - index
        Returns:
        bin limits for axis and upper/lower bound for dimIndex bin
      • getValue

        public double getValue​(int dimIndex,
                               double... x)
        Description copied from interface: DataSet
        Returns the value along the 'dimIndex' axis of a point specified by the x coordinate.
        Specified by:
        getValue in interface DataSet
        Overrides:
        getValue in class AbstractDataSet<AbstractHistogram>
        Parameters:
        dimIndex - the dimension index (ie. '0' equals 'X', '1' equals 'Y')
        x - horizontal 'dimIndex' coordinate
        Returns:
        'dimIndex' value
      • reset

        public void reset()
        Description copied from interface: Histogram
        reset histogram content
        Specified by:
        reset in interface Histogram
      • swap

        protected static <T> void swap​(T[] arr,
                                       int i,
                                       int j)