Documentation of 'org.jplot2d.element.Plot' Java class
Plot
org.jplot2d.element

Interface Plot

  • All Superinterfaces:
    Element, PComponent
    All Known Subinterfaces:
    PlotEx
    All Known Implementing Classes:
    PlotImpl


    public interface Plot
    extends PComponent
    Plot has a content area in the center, surrounded by margin area. The margin area holds axes, titles and legend.

    Plot can contains a group of layers that stack over each other, their viewports have the same bounds of the content area.
    Plot can also contains a group of subplots, which are laid out by LayoutDirector.

    • Method Detail

      • getParent

        Plot getParent()
        Description copied from interface: PComponent
        Gets the parent of this component.
        Specified by:
        getParent in interface Element
        Specified by:
        getParent in interface PComponent
        Returns:
        the parent of this component
      • getSizeMode

        SizeMode getSizeMode()
        Returns the size mode of this plot.
        Returns:
      • setSizeMode

        void setSizeMode(SizeMode mode)
        Sets a size mode to manage the size and scale of this plot according to its container size. The mode must be set when displaying a plot in a swing/swt component.
        Parameters:
        mode -
      • getContainerSize

        java.awt.geom.Dimension2D getContainerSize()
        Returns the container size in device coordinate system.
        Returns:
        the container size
      • setContainerSize

        void setContainerSize(java.awt.geom.Dimension2D size)
        Sets the container size. The container size is given in device coordinate system and used by size mode to derive paper size and scale. The default value is 640x480 pixels.

        If the size mode is null when calling this method, an IllegalStateException will be thrown.

        Parameters:
        size -
      • getScale

        double getScale()
        Returns the scale of this plot. The scale is ratio device size to paper size.
        Returns:
        the scale of this plot
      • setScale

        void setScale(double scale)
        Sets scale of this plot. This method only take effect when size mode is null. Otherwise the scale is decided by size mode.
        Parameters:
        scale - the scale
      • setSize

        void setSize(java.awt.geom.Dimension2D size)
        Sets the paper size of this plot. This method only take effect when size mode is null. Otherwise the size is decided by size mode.
        Parameters:
        size - the paper size
      • setSize

        void setSize(double width,
                     double height)
        Sets the paper size of this plot. This method only take effect when size mode is null. Otherwise the size is decided by size mode.

        For subplot, the size is set by layout manager.

        Parameters:
        width - the paper width
        height - the paper height
      • getLayoutDirector

        LayoutDirector getLayoutDirector()
        Gets the layout director for this plot.
        Returns:
        the layout director for this plot.
      • setLayoutDirector

        void setLayoutDirector(LayoutDirector director)
        Sets the layout director for this plot.
        Parameters:
        director - the layout director
      • getConstraint

        java.lang.Object getConstraint(Plot subplot)
        Returns the constraint of the specified subplot in the current LayoutManager.
        Parameters:
        subplot - The subplot whose constraint is being set
        Returns:
        the constraint
        Throws:
        java.lang.IllegalArgumentException - if the subplot is not contained by this plot
      • setConstraint

        void setConstraint(Plot subplot,
                           java.lang.Object constraint)
        Sets the constraint of the specified subplot in the current LayoutManager.
        Parameters:
        subplot - The subplot whose constraint is being set
        constraint - the constraint
        Throws:
        java.lang.IllegalArgumentException - if the subplot is not contained by this plot
      • getPreferredContentSize

        java.awt.geom.Dimension2D getPreferredContentSize()
        Returns the the preferred content area size.
        Returns:
        the the preferred content area size
      • setPreferredContentSize

        void setPreferredContentSize(java.awt.geom.Dimension2D size)
        Sets the preferred content area size
        Parameters:
        size - the size in Dimension2D
      • setPreferredContentSize

        void setPreferredContentSize(double width,
                                     double height)
        Sets the preferred content area size
        Parameters:
        width - the width
        height - the height
      • getLocation

        java.awt.geom.Point2D getLocation()
        Gets the location of this plot in its parent plot. The origin of a plot is the bottom-left corner of the content box (the intersect point of left axis and bottom axis). For root plot, the returned value is always (0,0)
        Specified by:
        getLocation in interface PComponent
        Returns:
        an instance of Point representing the base point of this plot
      • setLocation

        void setLocation(java.awt.geom.Point2D loc)
        Moves this plot to a new location. The new location is specified by point and is given in the parent's paper coordinate space.

        Notice: This method should be called when the parent plot's layout director does not manage subplots, such as SimpleLayoutDirector, otherwise the location will be overwrite by the layout director.

        For root plot, this method has no effect.

        Parameters:
        p - the point defining the origin of the new location
      • setLocation

        void setLocation(double locX,
                         double locY)
      • getContentSize

        java.awt.geom.Dimension2D getContentSize()
        Returns the size of content area.
        Returns:
        the size of content area.
      • getMargin

        PlotMargin getMargin()
        Returns the margin area of this plot.
        Returns:
      • getLegend

        Legend getLegend()
        Returns the legend of this plot.
        Returns:
        the legend of this plot
      • getTitle

        Title getTitle(int index)
        Gets the nth title in this plot.
        Parameters:
        n - the index of the title to get.
        Returns:
        the nth title in this plot
      • getTitles

        Title[] getTitles()
        Returns all titles in the order of added.
        Returns:
        all titles
      • addTitle

        void addTitle(Title title)
      • removeTitle

        void removeTitle(Title title)
      • getXAxis

        Axis getXAxis(int index)
      • getYAxis

        Axis getYAxis(int index)
      • getXAxes

        Axis[] getXAxes()
      • getYAxes

        Axis[] getYAxes()
      • addXAxis

        void addXAxis(Axis axis)
      • addYAxis

        void addYAxis(Axis axis)
      • removeXAxis

        void removeXAxis(Axis axis)
        Removes the specified X axis from this plot if it is present.
        Parameters:
        axis - the X axis to be removed
      • removeYAxis

        void removeYAxis(Axis axis)
        Removes the specified Y axis from this plot if it is present.
        Parameters:
        axis - the Y axis to be removed
      • getLayer

        Layer getLayer(int index)
        Gets the nth layer in this plot.
        Parameters:
        n - the index of the layer to get.
        Returns:
        the nth layer in this plot
      • getLayers

        Layer[] getLayers()
        Returns all layers in the order of added.
        Returns:
        all layers
      • addLayer

        void addLayer(Layer layer)
        Add a layer to this plot. The layer will not associate with any axis range manager. Before the layer associate axis transform by Layer.setAxesTransform(AxisTransform, AxisTransform), all its subcomponents are invisible.
        Parameters:
        layer - the layer to be added
      • addLayer

        void addLayer(Layer layer,
                      AxisTransform xRangeManager,
                      AxisTransform yRangeManager)
        Add a layer to this plot. The layer will associate with the given X/Y axis range manager to control which part show in the plot viewport.
        Parameters:
        layer - the layer to be added
        xRangeManager - the x axis range manager
        yRangeManager - the y axis range manager
      • removeLayer

        void removeLayer(Layer layer)
      • getSubplot

        Plot getSubplot(int n)
        Gets the nth subplot in this plot.
        Parameters:
        n - the index of the component to get.
        Returns:
        the nth subplot in this subplot
      • getSubplots

        Plot[] getSubplots()
        Gets the nth subplot in this plot.
        Parameters:
        n - the index of the component to get.
        Returns:
        the nth subplot in this plot
      • addSubplot

        void addSubplot(Plot subplot,
                        java.lang.Object constraint)
        Add a subplot with a constraint to this plot.
        Parameters:
        subplot - the subplot to be added
        constraint - an object expressing layout constraints
      • removeSubplot

        void removeSubplot(Plot subplot)
        remove the specified subplot from this plot.
        Parameters:
        subplot -
      • setSubplotConstraint

        void setSubplotConstraint(Plot subplot,
                                  java.lang.Object constraint)
        Set a new layout constraint for the given subplot.
        Parameters:
        subplot - the subplot
        constraint - an object expressing layout constraints
      • zoomXRange

        void zoomXRange(double start,
                        double end)
        Zoom the given range to entire X axis. The behavior is like, creating a temporary AxisRangeLockGroup to group all AxisRangeLockGroups which zoomable are true in this plot, and zoom the range on it.
        Parameters:
        start - the normalized start
        end - the normalized end
      • zoomYRange

        void zoomYRange(double start,
                        double end)
        Zoom the given range to entire Y axis. The behavior is like, creating a temporary AxisRangeLockGroup to group all AxisRangeLockGroups which zoomable are true in this plot, and zoom the range on it.
        Parameters:
        start - the normalized start
        end - the normalized end
      • adaptiveZoomX

        void adaptiveZoomX()
        Adaptive zoom the x range for all axes in this plot. Only axes whoes AxisRangeLockGroups is zoomable are zoomed.
      • adaptiveZoomY

        void adaptiveZoomY()
        Adaptive zoom the y range for all axes in this plot. Only axes whoes AxisRangeLockGroups is zoomable are zoomed.

DMelt 3.0 © DataMelt by jWork.ORG

Ads help maintain this website.