Class PlotFrame

All Implemented Interfaces:
ClipboardOwner, ImageObserver, MenuContainer, Serializable, Accessible, RootPaneContainer, WindowConstants, AppFrame, Hidable
Direct Known Subclasses:
FFTRealFrame

public class PlotFrame extends DrawingFrame
PlotFrame displays a plot using a dedicated DatasetManager. PlotFrame is a composite object that forwards methods to other objects such as a DatasetManager or a DataTable.
Version:
1.0
Author:
W. Christian
See Also:
  • Field Details

  • Constructor Details

    • PlotFrame

      public PlotFrame(String xlabel, String ylabel, String frameTitle)
      Constructs the PlottingFrame with the given frame title and axes labels.
      Parameters:
      xlabel - String
      ylabel - String
      frameTitle - String
  • Method Details

    • getDataTable

      protected DataTable getDataTable()
    • setName

      public void setName(String name)
      Sets the name of this component and the Dataset Manager.
      Overrides:
      setName in class Component
    • addMenuItems

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

      public void setLogScaleX(boolean log)
      Sets the log scale property for the x axis.
      Parameters:
      log - boolean
    • setLogScaleY

      public void setLogScaleY(boolean log)
      Sets the log scale property for the y axis.
      Parameters:
      log - boolean
    • scale

      protected void scale()
    • logAxes

      protected void logAxes()
    • append

      public void append(int datasetIndex, double x, double y)
      Appends an (x,y) datum to the Dataset with the given index.
      Parameters:
      datasetIndex - Description of Parameter
      x -
      y -
    • append

      public void append(int datasetIndex, double x, double y, double delx, double dely)
      Appends a data point and its uncertainty to the Dataset. (not used)
      Parameters:
      datasetIndex -
      x -
      y -
      delx -
      dely -
    • append

      public void append(int datasetIndex, double[] xpoints, double[] ypoints)
      Appends (x,y) arrays to the Dataset.
      Parameters:
      datasetIndex - Description of Parameter
      xpoints -
      ypoints -
    • append

      public void append(int datasetIndex, double[] xpoints, double[] ypoints, double[] delx, double[] dely)
      Appends arrays of data points and uncertainties to the Dataset.
      Parameters:
      datasetIndex -
      xpoints -
      ypoints -
      delx -
      dely -
    • setConnected

      public void setConnected(boolean connected)
      Sets the connected flag for all datasets.
      Parameters:
      connected - true if connected; false otherwise
    • setMaximumPoints

      public void setMaximumPoints(int datasetIndex, int maxPoints)
      Sets the maximum number of allowed datapoints. Points will be dropped from the beginning of the dataset after the maximum number has been reached.
      Parameters:
      maxPoints - int
    • setCustomMarker

      public void setCustomMarker(int datasetIndex, Shape marker)
      Sets a custom marker shape.
      Parameters:
      datasetIndex - int
      marker - Shape
    • setMarkerShape

      public void setMarkerShape(int datasetIndex, int markerShape)
      Sets the data point marker shape. Shapes are: NO_MARKER, CIRCLE, SQUARE, AREA, PIXEL, BAR, POST
      Parameters:
      datasetIndex - The new markerShape value
      markerShape -
    • setMarkerSize

      public void setMarkerSize(int datasetIndex, int markerSize)
      Sets the half-width of the data point marker.
      Parameters:
      datasetIndex -
      markerSize - in pixels
    • setMarkerColor

      public void setMarkerColor(int datasetIndex, Color color)
      Sets the data marker color for the given index.
      Parameters:
      datasetIndex - int
      color - Color
    • setLineColor

      public void setLineColor(int datasetIndex, Color color)
      Sets the data line color for the given index.
      Parameters:
      datasetIndex - int
      color - Color
    • setBackground

      public void setBackground(Color color)
      Sets the background color of this component.
      Overrides:
      setBackground in class Frame
    • setMarkerColor

      public void setMarkerColor(int datasetIndex, Color fillColor, Color edgeColor)
      Sets the marker's fill and edge colors. The error bar color is set equal to the edge color.
      Parameters:
      datasetIndex -
      fillColor -
      edgeColor -
    • setConnected

      public void setConnected(int datasetIndex, boolean connected)
      Sets the data connected flag. Points are connected by straight lines.
      Parameters:
      datasetIndex - The new connected value
      connected - true<\code> if points are connected
    • setXPointsLinked

      public void setXPointsLinked(boolean linked)
      Sets the linked flag. X data for datasets > 0 will not be shown in a table view.
      Parameters:
      linked - The new value
    • setXYColumnNames

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

      public void setXYColumnNames(int datasetIndex, String xColumnName, String yColumnName)
      Sets the column names when rendering this dataset in a JTable.
      Parameters:
      datasetIndex - The new xYColumnNames value
      xColumnName -
      yColumnName -
    • setMaximumFractionDigits

      public void setMaximumFractionDigits(int maximumFractionDigits)
      Sets the maximum number of fraction digits to display for cells that have type Double
      Parameters:
      maximumFractionDigits - - maximum number of fraction digits to display
    • setMaximumFractionDigits

      public void setMaximumFractionDigits(String columnName, int maximumFractionDigits)
      Sets the maximum number of fraction digits to display in all data table columns with cthe given columnName.
      Parameters:
      maximumFractionDigits - - maximum number of fraction digits to display
      columnName - The new maximumFractionDigits value
    • setRowNumberVisible

      public void setRowNumberVisible(boolean vis)
      Sets the display row number flag. Table displays row number.
      Parameters:
      vis - true<\code> if table display row number
    • clearDrawables

      public void clearDrawables()
      Clears drawable objects added by the user to this frame.
      Overrides:
      clearDrawables in class DrawingFrame
    • getDataset

      public Dataset getDataset(int index)
      Gets a dataset with the given index.
      Parameters:
      index -
      Returns:
      Dataset
    • getDatasetManager

      public DatasetManager getDatasetManager()
      Gets the dataset manager.
      Returns:
      DatasetManager
    • 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 the data from all datasets. Dataset properties are preserved because only the data is cleared.
      Overrides:
      clearData in class OSPFrame
    • removeDatasets

      public void removeDatasets()
      Removes datasets from the manager. New datasets will be created with default properties as needed.
    • showDataTable

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

      public static XML.ObjectLoader getLoader()
      Returns an XML.ObjectLoader to save and load data.
      Returns:
      the object loader
    • updateTable

      public void updateTable(int mode)