Class HistogramFrame

All Implemented Interfaces:
ClipboardOwner, ImageObserver, MenuContainer, Serializable, Accessible, RootPaneContainer, WindowConstants, AppFrame, Hidable

public class HistogramFrame extends DrawingFrame
HistogramFrame displays a histogram using a dedicated Histogram object.
Version:
1.0
Author:
W. Christian
See Also:
  • Field Details

  • Constructor Details

    • HistogramFrame

      public HistogramFrame(String xlabel, String ylabel, String title)
      A DrawingFrame with a Histogram as its drawable.
      Parameters:
      xlabel - String
      ylabel - String
      title - String
  • Method Details

    • setXYColumnNames

      public void setXYColumnNames(String xColumnName, String yColumnName, String histogramName)
      Sets the column names and the dataset name.
      Parameters:
      datasetIndex - The new xYColumnNames value
      xColumnName -
      yColumnName -
      datasetName -
    • addMenuItems

      protected void addMenuItems()
      Adds Views menu items on the menu bar.
      Overrides:
      addMenuItems in class DrawingFrame
    • loadToolsMenu

      protected JMenu loadToolsMenu()
      Adds launchable tools to the specified menu.
      Overrides:
      loadToolsMenu in class DrawingFrame
    • getXPoints

      public double[] getXPoints()
      Gets an array containing the bin centers.
      Returns:
      the bins
    • getYPoints

      public double[] getYPoints()
      Gets an array containing the values stored in the bins.
      Returns:
      the values of the bins
    • getLogPoints

      public double[][] getLogPoints()
      Gets an array containing the log values of the values stored in the bins.
      Returns:
      the values of the bins
    • getPoints

      public double[][] getPoints()
      Gets a data array containing both the bin centers and the values within the bins.
      Returns:
      a double[index][2] array of data
    • clearDrawables

      public void clearDrawables()
      Removes drawable objects added by the user from this frame.
      Overrides:
      clearDrawables in class DrawingFrame
    • getDrawables

      public ArrayList<Drawable> getDrawables()
      Gets Drawable objects added by the user to this frame.
      Overrides:
      getDrawables in class DrawingFrame
      Returns:
      the list
    • getDrawables

      public <T extends Drawable> ArrayList<T> getDrawables(Class<T> c)
      Gets Drawable objects added by the user of an assignable type. The list contains objects that are assignable from the class or interface.
      Overrides:
      getDrawables in class DrawingFrame
      Parameters:
      c - the type of Drawable object
      Returns:
      the cloned list
      See Also:
    • clearData

      public void clearData()
      Clears all the data stored.
      Overrides:
      clearData in class OSPFrame
    • append

      public void append(double v)
      Appends a data point to the histogram.
      Parameters:
      v - data point
    • append

      public void append(double value, double numberOfOccurences)
      Append a value with number of occurences to the Histogram.
      Parameters:
      value -
      numberOfOccurences -
    • append

      public void append(double[] values)
      Appends an array of values with 1 occurence.
      Parameters:
      values -
    • setDiscrete

      public void setDiscrete(boolean b)
      Sets the discrete flag in the histogram.
      Parameters:
      b - true<\code> if bins are discrete, false<\code> if bins are continuous.
    • setLogScale

      public void setLogScale(boolean b)
      Histogram uses logarithmic scale (true/false)
    • isLogScale

      public boolean isLogScale()
      Gets the histogram's log scale value.
      Returns:
      boolean
    • setBinWidth

      public void setBinWidth(double binWidth)
      Sets the width of the bins.
      Parameters:
      binWidth -
    • getBinWidth

      public double getBinWidth()
      Gets the width of the bins.
      Parameters:
      binWidth -
    • setBinColor

      public void setBinColor(Color fillColor, Color edgeColor)
      Sets the bin's fill and edge colors. If the fill color is null the bin is not filled.
      Parameters:
      fillColor -
      edgeColor -
    • setBinStyle

      public void setBinStyle(short style)
      Sets the style for drawing this histogram. Options are DRAW_POINT, which draws a point at the top of the bin, and DRAW_BIN which draws the entire bin down to the x axis. Default is DRAW_BIN.
      Parameters:
      style -
    • setBinOffset

      public void setBinOffset(double binOffset)
      Sets the offset of the bins. Default is 0. A value will be appended to bin n if n*binWidth +binOffset <= value < (n+1)*binWidth +binOffset
      Parameters:
      binOffset -
    • setNormalizedToOne

      public void setNormalizedToOne(boolean b)
      Normalizes the occurrences in this histogram to one (true/false).
    • positiveX

      public void positiveX()
      Makes the x axis positive by default.
    • showDataTable

      public void showDataTable(boolean show)
      Shows or hides the data table.
      Parameters:
      show - boolean
    • getLoader

      public static XML.ObjectLoader getLoader()