Class AbstractHistogram

    • Field Detail

      • dataLabels

        protected java.util.Map<java.lang.Integer,​java.lang.String> dataLabels
      • dataStyles

        protected java.util.Map<java.lang.Integer,​java.lang.String> dataStyles
    • Constructor Detail

      • AbstractHistogram

        public AbstractHistogram​(java.lang.String name,
                                 int nBins,
                                 double minX,
                                 double maxX)
        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
      • AbstractHistogram

        public AbstractHistogram​(java.lang.String name,
                                 int nBinsX,
                                 double minX,
                                 double maxX,
                                 int nBinsY,
                                 double minY,
                                 double maxY)
        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
      • AbstractHistogram

        public AbstractHistogram​(java.lang.String name,
                                 double[] xBins)
        Creates histogram with name and range [minX, maxX]
        Parameters:
        name - of the data sets
        xBins - the initial bin array (defines [minX, maxX] and nBins)
    • Method Detail

      • isEquiDistant

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

        public DataRange getValueRange()
        Returns:
        range of bin contents
      • getDataLabelMap

        public java.util.Map<java.lang.Integer,​java.lang.String> getDataLabelMap()
        Returns:
        data labels for each bin
      • getDataStyleMap

        public java.util.Map<java.lang.Integer,​java.lang.String> getDataStyleMap()
        Returns:
        data styling map (CSS-related)
      • addDataStyle

        public java.lang.String addDataStyle​(int index,
                                             java.lang.String style)
        A string representation of the CSS style associated with this specific DataSet data point. @see #getStyle()
        Overrides:
        addDataStyle in class AbstractDataSet<AbstractHistogram>
        Parameters:
        index - the index of the specific data point
        style - the CSS style for the given data bin
        Returns:
        itself (fluent interface)
      • removeStyle

        public java.lang.String removeStyle​(int index)
        A string representation of the CSS style associated with this specific DataSet data point. @see #getStyle()
        Overrides:
        removeStyle in class AbstractDataSet<AbstractHistogram>
        Parameters:
        index - the index of the specific data point
        Returns:
        itself (fluent interface)
      • getStyle

        public java.lang.String getStyle​(int bin)
        A string representation of the CSS style associated with this specific DataSet data point. @see #getStyle()
        Specified by:
        getStyle in interface DataSet
        Overrides:
        getStyle in class AbstractDataSet<AbstractHistogram>
        Parameters:
        bin - the index of the specific data point
        Returns:
        user-specific data set style description (ie. may be set by user)
      • addDataLabel

        public java.lang.String addDataLabel​(int index,
                                             java.lang.String label)
        adds a custom new data label for a point The label can be used as a category name if CategoryStepsDefinition is used or for annotations displayed for data points.
        Overrides:
        addDataLabel in class AbstractDataSet<AbstractHistogram>
        Parameters:
        index - of the data point
        label - for the data point specified by the index
        Returns:
        the previously set label or null if no label has been specified
      • removeDataLabel

        public java.lang.String removeDataLabel​(int index)
        remove a custom data label for a point The label can be used as a category name if CategoryStepsDefinition is used or for annotations displayed for data points.
        Overrides:
        removeDataLabel in class AbstractDataSet<AbstractHistogram>
        Parameters:
        index - of the data point
        Returns:
        the previously set label or null if no label has been specified
      • getDataLabel

        public java.lang.String getDataLabel​(int index)
        Returns label of a data point specified by the index. The label can be used as a category name if CategoryStepsDefinition is used or for annotations displayed for data points.
        Specified by:
        getDataLabel in interface DataSet
        Overrides:
        getDataLabel in class AbstractDataSet<AbstractHistogram>
        Parameters:
        index - of the data label
        Returns:
        data point label specified by the index or null if no label has been specified
      • 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
      • 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
      • getMinimum

        public double getMinimum()
        Specified by:
        getMinimum in interface Histogram
        Returns:
        minimum of histogram values
      • getMaximum

        public double getMaximum()
        Specified by:
        getMaximum in interface Histogram
        Returns:
        maximum of histogram values
      • findNextLargerIndex

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

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

        protected int findBinX​(double x)
      • findBinY

        protected int findBinY​(double y)
      • findBinZ

        protected int findBinZ​(double z)
      • 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
      • getBinCenterX

        public double getBinCenterX​(int binX)
        Specified by:
        getBinCenterX in interface Histogram
        Parameters:
        binX - index
        Returns:
        bin centre for X axis
      • getBinCenterY

        public double getBinCenterY​(int binY)
        Specified by:
        getBinCenterY in interface Histogram
        Parameters:
        binY - index
        Returns:
        bin centre for X axis
      • getBinCenterZ

        public double getBinCenterZ​(int binZ)
        Specified by:
        getBinCenterZ in interface Histogram
        Parameters:
        binZ - index
        Returns:
        bin centre for X axis
      • reset

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

        public int getDimension()
        Specified by:
        getDimension in interface Histogram
        Returns:
        number of dimensions
      • getNBinsX

        public int getNBinsX()
        Specified by:
        getNBinsX in interface Histogram
        Returns:
        number of bin alongside X axis
      • getNBinsY

        public int getNBinsY()
        Specified by:
        getNBinsY in interface Histogram
        Returns:
        number of bin alongside Y axis
      • getNBinsZ

        public int getNBinsZ()
        Specified by:
        getNBinsZ in interface Histogram
        Returns:
        number of bin alongside Z axis
      • set

        public void set​(int xIndex,
                        int yIndex,
                        double x,
                        double y,
                        double z)
        Description copied from interface: DataSet3D
        Changes a data point at specified index to new values.
        Specified by:
        set in interface DataSet3D
        Parameters:
        xIndex - the x-axis coordinate index of the data point to be changed
        yIndex - the y-axis coordinate index of the data point to be changed
        x - X coordinate
        y - Y coordinate
        z - value on the z-axis