Class PlottingPanel

All Implemented Interfaces:
ActionListener, ImageObserver, MenuContainer, Serializable, EventListener, Accessible, InteractiveMouseHandler, OSPRuntime.Disposable, Renderable
Direct Known Subclasses:
DataToolTab.DataToolPlotter, TrackPlottingPanel

public class PlottingPanel extends InteractivePanel
A Drawing Panel that has an X axis, a Y axis, and a title.
Author:
Wolfgang Christian
See Also:
  • Field Details

    • axes

      protected DrawableAxes axes
    • log10

      protected static final double log10
    • logBase10Function

      protected static final LogBase10Function logBase10Function
    • id

      public int id
  • Constructor Details

    • PlottingPanel

      public PlottingPanel(String xlabel, String ylabel, String plotTitle)
      Constructs a new PlottingPanel that uses the given X axis label, Y axis label, and plot title.
      Parameters:
      xlabel - The X axis label.
      ylabel - The Y axis label.
      plotTitle - The plot title.
    • PlottingPanel

      public PlottingPanel(int _xAxisType, int _yAxisType)
      Constructs a new PlottingPanel that uses the given X axis type and Y axis type.
      Parameters:
      _xAxisType - The X axis type.
      _yAxisType - The Y axis type.
    • PlottingPanel

      public PlottingPanel(String xlabel, String ylabel, String plotTitle, int xAxisType, int yAxisType)
      Constructs a new PlottingPanel with cartesian axes that use the given X axis label, Y axis label, and plot title.
      Parameters:
      xlabel - The X axis label.
      ylabel - The Y axis label.
      plotTitle - The plot title.
      xAxisType - Description of Parameter
      yAxisType - Description of Parameter
  • Method Details

    • getInteractive

      public Interactive getInteractive()
      Gets the interactive drawable that was accessed by the last mouse event. This methods overrides the default implemenation in order to check for draggable axes.
      Overrides:
      getInteractive in class InteractivePanel
      Returns:
      the interactive object
    • getAxes

      public DrawableAxes getAxes()
      Gets the axes.
      Returns:
      the axes
    • initAxes

      protected void initAxes()
      Override to specify a different kind of axes.
    • setAxes

      public void setAxes(DrawableAxes _axes)
      Sets the axes.
      Parameters:
      _axes - the new axes
    • setPolar

      public void setPolar(String plotTitle, double deltaR)
      Converts this panel to polar coordinates
      Parameters:
      plotTitle - String
      deltaR - double
    • setCartesian

      public void setCartesian(String xLabel, String yLabel, String plotTitle)
      Converts this panel to cartesian coordinates.
      Parameters:
      xLabel - String
      yLabel - String
      plotTitle - String
    • setXLabel

      public void setXLabel(String label)
      Sets the label for the X (horizontal) axis.
      Parameters:
      label - the label
    • setYLabel

      public void setYLabel(String label)
      Sets the label for the Y (vertical) axis.
      Parameters:
      label - the label
    • setTitle

      public void setTitle(String title)
      Sets the title.
      Parameters:
      title - the title
    • setXLabel

      public void setXLabel(String label, String font_name)
      Sets the label and font for the X (horizontal) axis. If the font name is null, the font is unchanged.
      Parameters:
      label - the label
      font_name - the optional new font
    • setYLabel

      public void setYLabel(String label, String font_name)
      Sets the label and font for the Y (vertical) axis. If the font name is null, the font is unchanged.
      Parameters:
      label - the label
      font_name - the optional new font
    • setTitle

      public void setTitle(String title, String font_name)
      Sets the title and font. If the font name is null, the font is unchanged.
      Parameters:
      title -
      font_name - the optional new font
    • setAxesVisible

      public void setAxesVisible(boolean isVisible)
      Sets the visibility of the axes. Axes that are not visible will not be drawn.
      Parameters:
      isVisible -
    • setLogScale

      public void setLogScale(boolean _logScaleX, boolean _logScaleY)
      Sets Cartesian axes to log scale.
      Parameters:
      _logScaleX - The new logScale value
      _logScaleY - The new logScale value
    • setLogScaleX

      public void setLogScaleX(boolean _logScaleX)
      Sets Cartesian x-axes to log scale.
      Parameters:
      _logScaleX - The new logScale value
    • setLogScaleY

      public void setLogScaleY(boolean _logScaleY)
      Sets Cartesian axes to log scale.
      Parameters:
      _logScaleY - The new logScale value
    • computeGutters

      protected void computeGutters()
      Computes the size of the gutters using a Dimensioned object. Gutters are usually set by the axes to insure that there is enough space for axes labels. Other objects can, however, perform this function by implementing the Dimensioned interface.
      Overrides:
      computeGutters in class DrawingPanel
    • paintFirst

      protected void paintFirst(Graphics g)
      Paints before the panel iterates through its list of Drawables.
      Overrides:
      paintFirst in class DrawingPanel
      Parameters:
      g - Graphics
    • pixToX

      public double pixToX(int pix)
      Converts pixel to x world units.
      Overrides:
      pixToX in class DrawingPanel
      Parameters:
      pix -
      Returns:
      x panel units
    • xToPix

      public int xToPix(double x)
      Converts x from world to pixel units.
      Overrides:
      xToPix in class DrawingPanel
      Parameters:
      x -
      Returns:
      the pixel value of the x coordinate
    • xToGraphics

      public float xToGraphics(double x)
      Converts x from world to graphics device units.
      Overrides:
      xToGraphics in class DrawingPanel
      Parameters:
      x -
      Returns:
      the graphics device value of the x coordinate
    • pixToY

      public double pixToY(int pix)
      Converts pixel to x world units.
      Overrides:
      pixToY in class DrawingPanel
      Parameters:
      pix -
      Returns:
      x panel units
    • yToPix

      public int yToPix(double y)
      Converts y from world to pixel units.
      Overrides:
      yToPix in class DrawingPanel
      Parameters:
      y -
      Returns:
      the pixel value of the y coordinate
    • yToGraphics

      public float yToGraphics(double y)
      Converts y from world to graphics device units.
      Overrides:
      yToGraphics in class DrawingPanel
      Parameters:
      y -
      Returns:
      the graphics device value of the x coordinate
    • getBottomGutter

      public int getBottomGutter()
      Gets the bottom gutter of this DrawingPanel.
      Overrides:
      getBottomGutter in class DrawingPanel
      Returns:
      bottom gutter
    • getTopGutter

      public int getTopGutter()
      Gets the bottom gutter of this DrawingPanel.
      Overrides:
      getTopGutter in class DrawingPanel
      Returns:
      right gutter
    • setPixelScale

      public void setPixelScale()
      Calculates min and max values and the affine transformation based on the current size of the panel and the squareAspect boolean.
      Overrides:
      setPixelScale in class DrawingPanel
    • getLoader

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