Class XYPlot

    • Constructor Detail

      • XYPlot

        public XYPlot()
        Creates a new XYPlot instance with no dataset, no axes and no renderer. You should specify these items before using the plot.
      • XYPlot

        public XYPlot​(XYDataset dataset,
                      ValueAxis domainAxis,
                      ValueAxis rangeAxis,
                      XYItemRenderer renderer)
        Creates a new plot with the specified dataset, axes and renderer. Any of the arguments can be null, but in that case you should take care to specify the value before using the plot (otherwise a NullPointerException may be thrown).
        Parameters:
        dataset - the dataset (null permitted).
        domainAxis - the domain axis (null permitted).
        rangeAxis - the range axis (null permitted).
        renderer - the renderer (null permitted).
    • Method Detail

      • getPlotType

        public java.lang.String getPlotType()
        Returns the plot type as a string.
        Specified by:
        getPlotType in class Plot
        Returns:
        A short string describing the type of plot.
      • setAxisOffset

        public void setAxisOffset​(org.jfree.ui.RectangleInsets offset)
        Sets the axis offsets (gap between the data area and the axes) and sends a PlotChangeEvent to all registered listeners.
        Parameters:
        offset - the offset (null not permitted).
        See Also:
        getAxisOffset()
      • getDomainAxis

        public ValueAxis getDomainAxis​(int index)
        Returns the domain axis with the specified index, or null if there is no axis with that index.
        Parameters:
        index - the axis index.
        Returns:
        The axis (null possible).
        See Also:
        setDomainAxis(int, ValueAxis)
      • setDomainAxis

        public void setDomainAxis​(int index,
                                  ValueAxis axis,
                                  boolean notify)
        Sets a domain axis and, if requested, sends a PlotChangeEvent to all registered listeners.
        Parameters:
        index - the axis index.
        axis - the axis.
        notify - notify listeners?
        See Also:
        getDomainAxis(int)
      • getDomainAxisLocation

        public AxisLocation getDomainAxisLocation​(int index)
        Returns the location for a domain axis. If this hasn't been set explicitly, the method returns the location that is opposite to the primary domain axis location.
        Parameters:
        index - the axis index (must be >= 0).
        Returns:
        The location (never null).
        See Also:
        setDomainAxisLocation(int, AxisLocation)
      • getDomainAxisEdge

        public org.jfree.ui.RectangleEdge getDomainAxisEdge​(int index)
        Returns the edge for a domain axis.
        Parameters:
        index - the axis index.
        Returns:
        The edge.
        See Also:
        getRangeAxisEdge(int)
      • getRangeAxis

        public ValueAxis getRangeAxis​(int index)
        Returns the range axis with the specified index, or null if there is no axis with that index.
        Parameters:
        index - the axis index (must be >= 0).
        Returns:
        The axis (null possible).
        See Also:
        setRangeAxis(int, ValueAxis)
      • setRangeAxis

        public void setRangeAxis​(int index,
                                 ValueAxis axis,
                                 boolean notify)
        Sets a range axis and, if requested, sends a PlotChangeEvent to all registered listeners.
        Parameters:
        index - the axis index.
        axis - the axis (null permitted).
        notify - notify listeners?
        See Also:
        getRangeAxis(int)
      • getRangeAxisLocation

        public AxisLocation getRangeAxisLocation​(int index)
        Returns the location for a range axis. If this hasn't been set explicitly, the method returns the location that is opposite to the primary range axis location.
        Parameters:
        index - the axis index (must be >= 0).
        Returns:
        The location (never null).
        See Also:
        setRangeAxisLocation(int, AxisLocation)
      • getDataset

        public XYDataset getDataset​(int index)
        Returns the dataset with the specified index, or null if there is no dataset with that index.
        Parameters:
        index - the dataset index (must be >= 0).
        Returns:
        The dataset (possibly null).
        See Also:
        setDataset(int, XYDataset)
      • setDataset

        public void setDataset​(int index,
                               XYDataset dataset)
        Sets a dataset for the plot and sends a change event to all registered listeners.
        Parameters:
        index - the dataset index (must be >= 0).
        dataset - the dataset (null permitted).
        See Also:
        getDataset(int)
      • getDatasetCount

        public int getDatasetCount()
        Returns the number of datasets.
        Returns:
        The number of datasets.
      • indexOf

        public int indexOf​(XYDataset dataset)
        Returns the index of the specified dataset, or -1 if the dataset does not belong to the plot.
        Parameters:
        dataset - the dataset (null not permitted).
        Returns:
        The index or -1.
      • mapDatasetToDomainAxis

        public void mapDatasetToDomainAxis​(int index,
                                           int axisIndex)
        Maps a dataset to a particular domain axis. All data will be plotted against axis zero by default, no mapping is required for this case.
        Parameters:
        index - the dataset index (zero-based).
        axisIndex - the axis index.
        See Also:
        mapDatasetToRangeAxis(int, int)
      • mapDatasetToDomainAxes

        public void mapDatasetToDomainAxes​(int index,
                                           java.util.List axisIndices)
        Maps the specified dataset to the axes in the list. Note that the conversion of data values into Java2D space is always performed using the first axis in the list.
        Parameters:
        index - the dataset index (zero-based).
        axisIndices - the axis indices (null permitted).
        Since:
        1.0.12
      • mapDatasetToRangeAxis

        public void mapDatasetToRangeAxis​(int index,
                                          int axisIndex)
        Maps a dataset to a particular range axis. All data will be plotted against axis zero by default, no mapping is required for this case.
        Parameters:
        index - the dataset index (zero-based).
        axisIndex - the axis index.
        See Also:
        mapDatasetToDomainAxis(int, int)
      • mapDatasetToRangeAxes

        public void mapDatasetToRangeAxes​(int index,
                                          java.util.List axisIndices)
        Maps the specified dataset to the axes in the list. Note that the conversion of data values into Java2D space is always performed using the first axis in the list.
        Parameters:
        index - the dataset index (zero-based).
        axisIndices - the axis indices (null permitted).
        Since:
        1.0.12
      • getRendererCount

        public int getRendererCount()
        Returns the number of renderer slots for this plot.
        Returns:
        The number of renderer slots.
        Since:
        1.0.11
      • setRenderer

        public void setRenderer​(XYItemRenderer renderer)
        Sets the renderer for the primary dataset and sends a change event to all registered listeners. If the renderer is set to null, no data will be displayed.
        Parameters:
        renderer - the renderer (null permitted).
        See Also:
        getRenderer()
      • setRenderer

        public void setRenderer​(int index,
                                XYItemRenderer renderer)
        Sets the renderer for the dataset with the specified index and sends a change event to all registered listeners. Note that each dataset should have its own renderer, you should not use one renderer for multiple datasets.
        Parameters:
        index - the index (must be >= 0).
        renderer - the renderer.
        See Also:
        getRenderer(int)
      • setRenderer

        public void setRenderer​(int index,
                                XYItemRenderer renderer,
                                boolean notify)
        Sets the renderer for the dataset with the specified index and, if requested, sends a change event to all registered listeners. Note that each dataset should have its own renderer, you should not use one renderer for multiple datasets.
        Parameters:
        index - the index (must be >= 0).
        renderer - the renderer.
        notify - notify listeners?
        See Also:
        getRenderer(int)
      • setRenderers

        public void setRenderers​(XYItemRenderer[] renderers)
        Sets the renderers for this plot and sends a PlotChangeEvent to all registered listeners.
        Parameters:
        renderers - the renderers (null not permitted).
      • setDatasetRenderingOrder

        public void setDatasetRenderingOrder​(DatasetRenderingOrder order)
        Sets the rendering order and sends a PlotChangeEvent to all registered listeners. By default, the plot renders the primary dataset last (so that the primary dataset overlays the secondary datasets). You can reverse this if you want to.
        Parameters:
        order - the rendering order (null not permitted).
        See Also:
        getDatasetRenderingOrder()
      • getIndexOf

        public int getIndexOf​(XYItemRenderer renderer)
        Returns the index of the specified renderer, or -1 if the renderer is not assigned to this plot.
        Parameters:
        renderer - the renderer (null permitted).
        Returns:
        The renderer index.
      • getRendererForDataset

        public XYItemRenderer getRendererForDataset​(XYDataset dataset)
        Returns the renderer for the specified dataset (this is either the renderer with the same index as the dataset or, if there isn't a renderer with the same index, the default renderer). If the dataset does not belong to the plot, this method will return null.
        Parameters:
        dataset - the dataset (null permitted).
        Returns:
        The renderer (possibly null).
      • getWeight

        public int getWeight()
        Returns the weight for this plot when it is used as a subplot within a combined plot.
        Returns:
        The weight.
        See Also:
        setWeight(int)
      • setWeight

        public void setWeight​(int weight)
        Sets the weight for the plot and sends a PlotChangeEvent to all registered listeners.
        Parameters:
        weight - the weight.
        See Also:
        getWeight()
      • setDomainGridlinesVisible

        public void setDomainGridlinesVisible​(boolean visible)
        Sets the flag that controls whether or not the domain grid-lines are visible.

        If the flag value is changed, a PlotChangeEvent is sent to all registered listeners.

        Parameters:
        visible - the new value of the flag.
        See Also:
        isDomainGridlinesVisible()
      • setDomainGridlineStroke

        public void setDomainGridlineStroke​(java.awt.Stroke stroke)
        Sets the stroke for the grid lines plotted against the domain axis, and sends a PlotChangeEvent to all registered listeners.
        Parameters:
        stroke - the stroke (null not permitted).
        Throws:
        java.lang.IllegalArgumentException - if stroke is null.
        See Also:
        getDomainGridlineStroke()
      • setDomainMinorGridlineStroke

        public void setDomainMinorGridlineStroke​(java.awt.Stroke stroke)
        Sets the stroke for the minor grid lines plotted against the domain axis, and sends a PlotChangeEvent to all registered listeners.
        Parameters:
        stroke - the stroke (null not permitted).
        Throws:
        java.lang.IllegalArgumentException - if stroke is null.
        Since:
        1.0.12
        See Also:
        getDomainMinorGridlineStroke()
      • setDomainGridlinePaint

        public void setDomainGridlinePaint​(java.awt.Paint paint)
        Sets the paint for the grid lines plotted against the domain axis, and sends a PlotChangeEvent to all registered listeners.
        Parameters:
        paint - the paint (null not permitted).
        Throws:
        java.lang.IllegalArgumentException - if paint is null.
        See Also:
        getDomainGridlinePaint()
      • setDomainMinorGridlinePaint

        public void setDomainMinorGridlinePaint​(java.awt.Paint paint)
        Sets the paint for the minor grid lines plotted against the domain axis, and sends a PlotChangeEvent to all registered listeners.
        Parameters:
        paint - the paint (null not permitted).
        Throws:
        java.lang.IllegalArgumentException - if paint is null.
        Since:
        1.0.12
        See Also:
        getDomainMinorGridlinePaint()
      • setRangeGridlinesVisible

        public void setRangeGridlinesVisible​(boolean visible)
        Sets the flag that controls whether or not the range axis grid lines are visible.

        If the flag value is changed, a PlotChangeEvent is sent to all registered listeners.

        Parameters:
        visible - the new value of the flag.
        See Also:
        isRangeGridlinesVisible()
      • setRangeMinorGridlinesVisible

        public void setRangeMinorGridlinesVisible​(boolean visible)
        Sets the flag that controls whether or not the range axis minor grid lines are visible.

        If the flag value is changed, a PlotChangeEvent is sent to all registered listeners.

        Parameters:
        visible - the new value of the flag.
        Since:
        1.0.12
        See Also:
        isRangeMinorGridlinesVisible()
      • getQuadrantOrigin

        public java.awt.geom.Point2D getQuadrantOrigin()
        Returns the origin for the quadrants that can be displayed on the plot. This defaults to (0, 0).
        Returns:
        The origin point (never null).
        See Also:
        setQuadrantOrigin(Point2D)
      • getQuadrantPaint

        public java.awt.Paint getQuadrantPaint​(int index)
        Returns the paint used for the specified quadrant.
        Parameters:
        index - the quadrant index (0-3).
        Returns:
        The paint (possibly null).
        See Also:
        setQuadrantPaint(int, Paint)
      • setQuadrantPaint

        public void setQuadrantPaint​(int index,
                                     java.awt.Paint paint)
        Sets the paint used for the specified quadrant and sends a PlotChangeEvent to all registered listeners.
        Parameters:
        index - the quadrant index (0-3).
        paint - the paint (null permitted).
        See Also:
        getQuadrantPaint(int)
      • addDomainMarker

        public void addDomainMarker​(Marker marker,
                                    org.jfree.ui.Layer layer)
        Adds a marker for the domain axis in the specified layer and sends a PlotChangeEvent to all registered listeners.

        Typically a marker will be drawn by the renderer as a line perpendicular to the domain axis, however this is entirely up to the renderer.

        Parameters:
        marker - the marker (null not permitted).
        layer - the layer (foreground or background).
        See Also:
        addDomainMarker(int, Marker, Layer)
      • clearDomainMarkers

        public void clearDomainMarkers​(int index)
        Clears the (foreground and background) domain markers for a particular renderer and sends a PlotChangeEvent to all registered listeners.
        Parameters:
        index - the renderer index.
        See Also:
        clearRangeMarkers(int)
      • addDomainMarker

        public void addDomainMarker​(int index,
                                    Marker marker,
                                    org.jfree.ui.Layer layer)
        Adds a marker for a specific dataset/renderer and sends a PlotChangeEvent to all registered listeners.

        Typically a marker will be drawn by the renderer as a line perpendicular to the domain axis (that the renderer is mapped to), however this is entirely up to the renderer.

        Parameters:
        index - the dataset/renderer index.
        marker - the marker.
        layer - the layer (foreground or background).
        See Also:
        clearDomainMarkers(int), addRangeMarker(int, Marker, Layer)
      • addDomainMarker

        public void addDomainMarker​(int index,
                                    Marker marker,
                                    org.jfree.ui.Layer layer,
                                    boolean notify)
        Adds a marker for a specific dataset/renderer and, if requested, sends a PlotChangeEvent to all registered listeners.

        Typically a marker will be drawn by the renderer as a line perpendicular to the domain axis (that the renderer is mapped to), however this is entirely up to the renderer.

        Parameters:
        index - the dataset/renderer index.
        marker - the marker.
        layer - the layer (foreground or background).
        notify - notify listeners?
        Since:
        1.0.10
      • removeDomainMarker

        public boolean removeDomainMarker​(Marker marker)
        Removes a marker for the domain axis and sends a PlotChangeEvent to all registered listeners.
        Parameters:
        marker - the marker.
        Returns:
        A boolean indicating whether or not the marker was actually removed.
        Since:
        1.0.7
      • removeDomainMarker

        public boolean removeDomainMarker​(Marker marker,
                                          org.jfree.ui.Layer layer)
        Removes a marker for the domain axis in the specified layer and sends a PlotChangeEvent to all registered listeners.
        Parameters:
        marker - the marker (null not permitted).
        layer - the layer (foreground or background).
        Returns:
        A boolean indicating whether or not the marker was actually removed.
        Since:
        1.0.7
      • removeDomainMarker

        public boolean removeDomainMarker​(int index,
                                          Marker marker,
                                          org.jfree.ui.Layer layer)
        Removes a marker for a specific dataset/renderer and sends a PlotChangeEvent to all registered listeners.
        Parameters:
        index - the dataset/renderer index.
        marker - the marker.
        layer - the layer (foreground or background).
        Returns:
        A boolean indicating whether or not the marker was actually removed.
        Since:
        1.0.7
      • removeDomainMarker

        public boolean removeDomainMarker​(int index,
                                          Marker marker,
                                          org.jfree.ui.Layer layer,
                                          boolean notify)
        Removes a marker for a specific dataset/renderer and, if requested, sends a PlotChangeEvent to all registered listeners.
        Parameters:
        index - the dataset/renderer index.
        marker - the marker.
        layer - the layer (foreground or background).
        notify - notify listeners?
        Returns:
        A boolean indicating whether or not the marker was actually removed.
        Since:
        1.0.10
      • addRangeMarker

        public void addRangeMarker​(Marker marker)
        Adds a marker for the range axis and sends a PlotChangeEvent to all registered listeners.

        Typically a marker will be drawn by the renderer as a line perpendicular to the range axis, however this is entirely up to the renderer.

        Parameters:
        marker - the marker (null not permitted).
        See Also:
        addRangeMarker(Marker, Layer)
      • addRangeMarker

        public void addRangeMarker​(Marker marker,
                                   org.jfree.ui.Layer layer)
        Adds a marker for the range axis in the specified layer and sends a PlotChangeEvent to all registered listeners.

        Typically a marker will be drawn by the renderer as a line perpendicular to the range axis, however this is entirely up to the renderer.

        Parameters:
        marker - the marker (null not permitted).
        layer - the layer (foreground or background).
        See Also:
        addRangeMarker(int, Marker, Layer)
      • addRangeMarker

        public void addRangeMarker​(int index,
                                   Marker marker,
                                   org.jfree.ui.Layer layer)
        Adds a marker for a specific dataset/renderer and sends a PlotChangeEvent to all registered listeners.

        Typically a marker will be drawn by the renderer as a line perpendicular to the range axis, however this is entirely up to the renderer.

        Parameters:
        index - the dataset/renderer index.
        marker - the marker.
        layer - the layer (foreground or background).
        See Also:
        clearRangeMarkers(int), addDomainMarker(int, Marker, Layer)
      • addRangeMarker

        public void addRangeMarker​(int index,
                                   Marker marker,
                                   org.jfree.ui.Layer layer,
                                   boolean notify)
        Adds a marker for a specific dataset/renderer and, if requested, sends a PlotChangeEvent to all registered listeners.

        Typically a marker will be drawn by the renderer as a line perpendicular to the range axis, however this is entirely up to the renderer.

        Parameters:
        index - the dataset/renderer index.
        marker - the marker.
        layer - the layer (foreground or background).
        notify - notify listeners?
        Since:
        1.0.10
      • clearRangeMarkers

        public void clearRangeMarkers​(int index)
        Clears the (foreground and background) range markers for a particular renderer.
        Parameters:
        index - the renderer index.
      • removeRangeMarker

        public boolean removeRangeMarker​(Marker marker)
        Removes a marker for the range axis and sends a PlotChangeEvent to all registered listeners.
        Parameters:
        marker - the marker.
        Returns:
        A boolean indicating whether or not the marker was actually removed.
        Since:
        1.0.7
      • removeRangeMarker

        public boolean removeRangeMarker​(Marker marker,
                                         org.jfree.ui.Layer layer)
        Removes a marker for the range axis in the specified layer and sends a PlotChangeEvent to all registered listeners.
        Parameters:
        marker - the marker (null not permitted).
        layer - the layer (foreground or background).
        Returns:
        A boolean indicating whether or not the marker was actually removed.
        Since:
        1.0.7
      • removeRangeMarker

        public boolean removeRangeMarker​(int index,
                                         Marker marker,
                                         org.jfree.ui.Layer layer)
        Removes a marker for a specific dataset/renderer and sends a PlotChangeEvent to all registered listeners.
        Parameters:
        index - the dataset/renderer index.
        marker - the marker (null not permitted).
        layer - the layer (foreground or background).
        Returns:
        A boolean indicating whether or not the marker was actually removed.
        Since:
        1.0.7
      • removeRangeMarker

        public boolean removeRangeMarker​(int index,
                                         Marker marker,
                                         org.jfree.ui.Layer layer,
                                         boolean notify)
        Removes a marker for a specific dataset/renderer and sends a PlotChangeEvent to all registered listeners.
        Parameters:
        index - the dataset/renderer index.
        marker - the marker (null not permitted).
        layer - the layer (foreground or background) (null not permitted).
        notify - notify listeners?
        Returns:
        A boolean indicating whether or not the marker was actually removed.
        Since:
        1.0.10
      • addAnnotation

        public void addAnnotation​(XYAnnotation annotation,
                                  boolean notify)
        Adds an annotation to the plot and, if requested, sends a PlotChangeEvent to all registered listeners.
        Parameters:
        annotation - the annotation (null not permitted).
        notify - notify listeners?
        Since:
        1.0.10
      • removeAnnotation

        public boolean removeAnnotation​(XYAnnotation annotation,
                                        boolean notify)
        Removes an annotation from the plot and sends a PlotChangeEvent to all registered listeners.
        Parameters:
        annotation - the annotation (null not permitted).
        notify - notify listeners?
        Returns:
        A boolean (indicates whether or not the annotation was removed).
        Since:
        1.0.10
      • getShadowGenerator

        public ShadowGenerator getShadowGenerator()
        Returns the shadow generator for the plot, if any.
        Returns:
        The shadow generator (possibly null).
        Since:
        1.0.14
      • setShadowGenerator

        public void setShadowGenerator​(ShadowGenerator generator)
        Sets the shadow generator for the plot and sends a PlotChangeEvent to all registered listeners.
        Parameters:
        generator - the generator (null permitted).
        Since:
        1.0.14
      • calculateAxisSpace

        protected AxisSpace calculateAxisSpace​(java.awt.Graphics2D g2,
                                               java.awt.geom.Rectangle2D plotArea)
        Calculates the space required for all the axes in the plot.
        Parameters:
        g2 - the graphics device.
        plotArea - the plot area.
        Returns:
        The required space.
      • calculateDomainAxisSpace

        protected AxisSpace calculateDomainAxisSpace​(java.awt.Graphics2D g2,
                                                     java.awt.geom.Rectangle2D plotArea,
                                                     AxisSpace space)
        Calculates the space required for the domain axis/axes.
        Parameters:
        g2 - the graphics device.
        plotArea - the plot area.
        space - a carrier for the result (null permitted).
        Returns:
        The required space.
      • calculateRangeAxisSpace

        protected AxisSpace calculateRangeAxisSpace​(java.awt.Graphics2D g2,
                                                    java.awt.geom.Rectangle2D plotArea,
                                                    AxisSpace space)
        Calculates the space required for the range axis/axes.
        Parameters:
        g2 - the graphics device.
        plotArea - the plot area.
        space - a carrier for the result (null permitted).
        Returns:
        The required space.
      • draw

        public void draw​(java.awt.Graphics2D g2,
                         java.awt.geom.Rectangle2D area,
                         java.awt.geom.Point2D anchor,
                         PlotState parentState,
                         PlotRenderingInfo info)
        Draws the plot within the specified area on a graphics device.
        Specified by:
        draw in class Plot
        Parameters:
        g2 - the graphics device.
        area - the plot area (in Java2D space).
        anchor - an anchor point in Java2D space (null permitted).
        parentState - the state from the parent plot, if there is one (null permitted).
        info - collects chart drawing information (null permitted).
      • drawBackground

        public void drawBackground​(java.awt.Graphics2D g2,
                                   java.awt.geom.Rectangle2D area)
        Draws the background for the plot.
        Overrides:
        drawBackground in class Plot
        Parameters:
        g2 - the graphics device.
        area - the area.
      • drawDomainTickBands

        public void drawDomainTickBands​(java.awt.Graphics2D g2,
                                        java.awt.geom.Rectangle2D dataArea,
                                        java.util.List ticks)
        Draws the domain tick bands, if any.
        Parameters:
        g2 - the graphics device.
        dataArea - the data area.
        ticks - the ticks.
        See Also:
        setDomainTickBandPaint(Paint)
      • drawRangeTickBands

        public void drawRangeTickBands​(java.awt.Graphics2D g2,
                                       java.awt.geom.Rectangle2D dataArea,
                                       java.util.List ticks)
        Draws the range tick bands, if any.
        Parameters:
        g2 - the graphics device.
        dataArea - the data area.
        ticks - the ticks.
        See Also:
        setRangeTickBandPaint(Paint)
      • drawAxes

        protected java.util.Map<Axis,​AxisStatedrawAxes​(java.awt.Graphics2D g2,
                                                               java.awt.geom.Rectangle2D plotArea,
                                                               java.awt.geom.Rectangle2D dataArea,
                                                               PlotRenderingInfo plotState)
        A utility method for drawing the axes.
        Parameters:
        g2 - the graphics device (null not permitted).
        plotArea - the plot area (null not permitted).
        dataArea - the data area (null not permitted).
        plotState - collects information about the plot (null permitted).
        Returns:
        A map containing the state for each axis drawn.
      • render

        public boolean render​(java.awt.Graphics2D g2,
                              java.awt.geom.Rectangle2D dataArea,
                              int index,
                              PlotRenderingInfo info,
                              CrosshairState crosshairState)
        Draws a representation of the data within the dataArea region, using the current renderer.

        The info and crosshairState arguments may be null.

        Parameters:
        g2 - the graphics device.
        dataArea - the region in which the data is to be drawn.
        index - the dataset index.
        info - an optional object for collection dimension information.
        crosshairState - collects crosshair information (null permitted).
        Returns:
        A flag that indicates whether any data was actually rendered.
      • getDomainAxisForDataset

        public ValueAxis getDomainAxisForDataset​(int index)
        Returns the domain axis for a dataset.
        Parameters:
        index - the dataset index (must be >= 0).
        Returns:
        The axis.
      • getRangeAxisForDataset

        public ValueAxis getRangeAxisForDataset​(int index)
        Returns the range axis for a dataset.
        Parameters:
        index - the dataset index (must be >= 0).
        Returns:
        The axis.
      • drawDomainGridlines

        protected void drawDomainGridlines​(java.awt.Graphics2D g2,
                                           java.awt.geom.Rectangle2D dataArea,
                                           java.util.List ticks)
        Draws the gridlines for the plot, if they are visible.
        Parameters:
        g2 - the graphics device.
        dataArea - the data area.
        ticks - the ticks.
        See Also:
        drawRangeGridlines(Graphics2D, Rectangle2D, List)
      • drawRangeGridlines

        protected void drawRangeGridlines​(java.awt.Graphics2D g2,
                                          java.awt.geom.Rectangle2D area,
                                          java.util.List ticks)
        Draws the gridlines for the plot's primary range axis, if they are visible.
        Parameters:
        g2 - the graphics device.
        area - the data area.
        ticks - the ticks.
        See Also:
        drawDomainGridlines(Graphics2D, Rectangle2D, List)
      • drawZeroDomainBaseline

        protected void drawZeroDomainBaseline​(java.awt.Graphics2D g2,
                                              java.awt.geom.Rectangle2D area)
        Draws a base line across the chart at value zero on the domain axis.
        Parameters:
        g2 - the graphics device.
        area - the data area.
        Since:
        1.0.5
        See Also:
        setDomainZeroBaselineVisible(boolean)
      • drawZeroRangeBaseline

        protected void drawZeroRangeBaseline​(java.awt.Graphics2D g2,
                                             java.awt.geom.Rectangle2D area)
        Draws a base line across the chart at value zero on the range axis.
        Parameters:
        g2 - the graphics device.
        area - the data area.
        See Also:
        setRangeZeroBaselineVisible(boolean)
      • drawAnnotations

        public void drawAnnotations​(java.awt.Graphics2D g2,
                                    java.awt.geom.Rectangle2D dataArea,
                                    PlotRenderingInfo info)
        Draws the annotations for the plot.
        Parameters:
        g2 - the graphics device.
        dataArea - the data area.
        info - the chart rendering info.
      • drawDomainMarkers

        protected void drawDomainMarkers​(java.awt.Graphics2D g2,
                                         java.awt.geom.Rectangle2D dataArea,
                                         int index,
                                         org.jfree.ui.Layer layer)
        Draws the domain markers (if any) for an axis and layer. This method is typically called from within the draw() method.
        Parameters:
        g2 - the graphics device.
        dataArea - the data area.
        index - the dataset/renderer index.
        layer - the layer (foreground or background).
      • drawRangeMarkers

        protected void drawRangeMarkers​(java.awt.Graphics2D g2,
                                        java.awt.geom.Rectangle2D dataArea,
                                        int index,
                                        org.jfree.ui.Layer layer)
        Draws the range markers (if any) for a renderer and layer. This method is typically called from within the draw() method.
        Parameters:
        g2 - the graphics device.
        dataArea - the data area.
        index - the renderer index.
        layer - the layer (foreground or background).
      • getDomainMarkers

        public java.util.Collection getDomainMarkers​(org.jfree.ui.Layer layer)
        Returns the list of domain markers (read only) for the specified layer.
        Parameters:
        layer - the layer (foreground or background).
        Returns:
        The list of domain markers.
        See Also:
        getRangeMarkers(Layer)
      • getRangeMarkers

        public java.util.Collection getRangeMarkers​(org.jfree.ui.Layer layer)
        Returns the list of range markers (read only) for the specified layer.
        Parameters:
        layer - the layer (foreground or background).
        Returns:
        The list of range markers.
        See Also:
        getDomainMarkers(Layer)
      • getDomainMarkers

        public java.util.Collection getDomainMarkers​(int index,
                                                     org.jfree.ui.Layer layer)
        Returns a collection of domain markers for a particular renderer and layer.
        Parameters:
        index - the renderer index.
        layer - the layer.
        Returns:
        A collection of markers (possibly null).
        See Also:
        getRangeMarkers(int, Layer)
      • getRangeMarkers

        public java.util.Collection getRangeMarkers​(int index,
                                                    org.jfree.ui.Layer layer)
        Returns a collection of range markers for a particular renderer and layer.
        Parameters:
        index - the renderer index.
        layer - the layer.
        Returns:
        A collection of markers (possibly null).
        See Also:
        getDomainMarkers(int, Layer)
      • drawHorizontalLine

        protected void drawHorizontalLine​(java.awt.Graphics2D g2,
                                          java.awt.geom.Rectangle2D dataArea,
                                          double value,
                                          java.awt.Stroke stroke,
                                          java.awt.Paint paint)
        Utility method for drawing a horizontal line across the data area of the plot.
        Parameters:
        g2 - the graphics device.
        dataArea - the data area.
        value - the coordinate, where to draw the line.
        stroke - the stroke to use.
        paint - the paint to use.
      • drawDomainCrosshair

        protected void drawDomainCrosshair​(java.awt.Graphics2D g2,
                                           java.awt.geom.Rectangle2D dataArea,
                                           PlotOrientation orientation,
                                           double value,
                                           ValueAxis axis,
                                           java.awt.Stroke stroke,
                                           java.awt.Paint paint)
        Draws a domain crosshair.
        Parameters:
        g2 - the graphics target.
        dataArea - the data area.
        orientation - the plot orientation.
        value - the crosshair value.
        axis - the axis against which the value is measured.
        stroke - the stroke used to draw the crosshair line.
        paint - the paint used to draw the crosshair line.
        Since:
        1.0.4
      • drawVerticalLine

        protected void drawVerticalLine​(java.awt.Graphics2D g2,
                                        java.awt.geom.Rectangle2D dataArea,
                                        double value,
                                        java.awt.Stroke stroke,
                                        java.awt.Paint paint)
        Utility method for drawing a vertical line on the data area of the plot.
        Parameters:
        g2 - the graphics device.
        dataArea - the data area.
        value - the coordinate, where to draw the line.
        stroke - the stroke to use.
        paint - the paint to use.
      • drawRangeCrosshair

        protected void drawRangeCrosshair​(java.awt.Graphics2D g2,
                                          java.awt.geom.Rectangle2D dataArea,
                                          PlotOrientation orientation,
                                          double value,
                                          ValueAxis axis,
                                          java.awt.Stroke stroke,
                                          java.awt.Paint paint)
        Draws a range crosshair.
        Parameters:
        g2 - the graphics target.
        dataArea - the data area.
        orientation - the plot orientation.
        value - the crosshair value.
        axis - the axis against which the value is measured.
        stroke - the stroke used to draw the crosshair line.
        paint - the paint used to draw the crosshair line.
        Since:
        1.0.4
      • handleClick

        public void handleClick​(int x,
                                int y,
                                PlotRenderingInfo info)
        Handles a 'click' on the plot by updating the anchor values.
        Overrides:
        handleClick in class Plot
        Parameters:
        x - the x-coordinate, where the click occurred, in Java2D space.
        y - the y-coordinate, where the click occurred, in Java2D space.
        info - object containing information about the plot dimensions.
      • setDomainCrosshairValue

        public void setDomainCrosshairValue​(double value,
                                            boolean notify)
        Sets the domain crosshair value and, if requested, sends a PlotChangeEvent to all registered listeners (provided that the domain crosshair is visible).
        Parameters:
        value - the new value.
        notify - notify listeners?
        See Also:
        getDomainCrosshairValue()
      • setDomainCrosshairStroke

        public void setDomainCrosshairStroke​(java.awt.Stroke stroke)
        Sets the Stroke used to draw the crosshairs (if visible) and notifies registered listeners that the axis has been modified.
        Parameters:
        stroke - the new crosshair stroke (null not permitted).
        See Also:
        getDomainCrosshairStroke()
      • setRangeCrosshairVisible

        public void setRangeCrosshairVisible​(boolean flag)
        Sets the flag indicating whether or not the range crosshair is visible. If the flag value changes, this method sends a PlotChangeEvent to all registered listeners.
        Parameters:
        flag - the new value of the flag.
        See Also:
        isRangeCrosshairVisible()
      • setRangeCrosshairValue

        public void setRangeCrosshairValue​(double value)
        Sets the range crosshair value.

        Registered listeners are notified that the plot has been modified, but only if the crosshair is visible.

        Parameters:
        value - the new value.
        See Also:
        getRangeCrosshairValue()
      • setRangeCrosshairValue

        public void setRangeCrosshairValue​(double value,
                                           boolean notify)
        Sets the range crosshair value and sends a PlotChangeEvent to all registered listeners, but only if the crosshair is visible.
        Parameters:
        value - the new value.
        notify - a flag that controls whether or not listeners are notified.
        See Also:
        getRangeCrosshairValue()
      • isDomainPannable

        public boolean isDomainPannable()
        Returns true if panning is enabled for the domain axes, and false otherwise.
        Specified by:
        isDomainPannable in interface Pannable
        Returns:
        A boolean.
        Since:
        1.0.13
      • setDomainPannable

        public void setDomainPannable​(boolean pannable)
        Sets the flag that enables or disables panning of the plot along the domain axes.
        Parameters:
        pannable - the new flag value.
        Since:
        1.0.13
      • isRangePannable

        public boolean isRangePannable()
        Returns true if panning is enabled for the range axis/axes, and false otherwise. The default value is false.
        Specified by:
        isRangePannable in interface Pannable
        Returns:
        A boolean.
        Since:
        1.0.13
      • setRangePannable

        public void setRangePannable​(boolean pannable)
        Sets the flag that enables or disables panning of the plot along the range axis/axes.
        Parameters:
        pannable - the new flag value.
        Since:
        1.0.13
      • panDomainAxes

        public void panDomainAxes​(double percent,
                                  PlotRenderingInfo info,
                                  java.awt.geom.Point2D source)
        Pans the domain axes by the specified percentage.
        Specified by:
        panDomainAxes in interface Pannable
        Parameters:
        percent - the distance to pan (as a percentage of the axis length).
        info - the plot info
        source - the source point where the pan action started.
        Since:
        1.0.13
      • panRangeAxes

        public void panRangeAxes​(double percent,
                                 PlotRenderingInfo info,
                                 java.awt.geom.Point2D source)
        Pans the range axes by the specified percentage.
        Specified by:
        panRangeAxes in interface Pannable
        Parameters:
        percent - the distance to pan (as a percentage of the axis length).
        info - the plot info
        source - the source point where the pan action started.
        Since:
        1.0.13
      • zoomDomainAxes

        public void zoomDomainAxes​(double lowerPercent,
                                   double upperPercent,
                                   PlotRenderingInfo info,
                                   java.awt.geom.Point2D source)
        Zooms in on the domain axis/axes. The new lower and upper bounds are specified as percentages of the current axis range, where 0 percent is the current lower bound and 100 percent is the current upper bound.
        Specified by:
        zoomDomainAxes in interface Zoomable
        Parameters:
        lowerPercent - a percentage that determines the new lower bound for the axis (e.g. 0.20 is twenty percent).
        upperPercent - a percentage that determines the new upper bound for the axis (e.g. 0.80 is eighty percent).
        info - the plot rendering info.
        source - the source point (ignored).
        See Also:
        zoomRangeAxes(double, double, PlotRenderingInfo, Point2D)
      • getSeriesCount

        public int getSeriesCount()
        Returns the number of series in the primary dataset for this plot. If the dataset is null, the method returns 0.
        Returns:
        The series count.
      • equals

        public boolean equals​(java.lang.Object obj)
        Tests this plot for equality with another object.
        Overrides:
        equals in class Plot
        Parameters:
        obj - the object (null permitted).
        Returns:
        true or false.
      • clone

        public java.lang.Object clone()
                               throws java.lang.CloneNotSupportedException
        Returns a clone of the plot.
        Specified by:
        clone in interface org.jfree.util.PublicCloneable
        Overrides:
        clone in class Plot
        Returns:
        A clone.
        Throws:
        java.lang.CloneNotSupportedException - this can occur if some component of the plot cannot be cloned.