Interface XYItemRenderer

    • Method Detail

      • getPlot

        XYPlot getPlot()
        Returns the plot that this renderer has been assigned to.
        Returns:
        The plot.
      • setPlot

        void setPlot​(XYPlot plot)
        Sets the plot that this renderer is assigned to. This method will be called by the plot class...you do not need to call it yourself.
        Parameters:
        plot - the plot.
      • getPassCount

        int getPassCount()
        Returns the number of passes through the data required by the renderer.
        Returns:
        The pass count.
      • findDomainBounds

        Range findDomainBounds​(XYDataset dataset)
        Returns the lower and upper bounds (range) of the x-values in the specified dataset.
        Parameters:
        dataset - the dataset (null permitted).
        Returns:
        The range.
      • findRangeBounds

        Range findRangeBounds​(XYDataset dataset)
        Returns the lower and upper bounds (range) of the y-values in the specified dataset. The implementation of this method will take into account the presentation used by the renderers (for example, a renderer that "stacks" values will return a bigger range than a renderer that doesn't).
        Parameters:
        dataset - the dataset (null permitted).
        Returns:
        The range (or null if the dataset is null or empty).
      • getItemVisible

        boolean getItemVisible​(int series,
                               int item)
        Returns a boolean that indicates whether or not the specified item should be drawn (this is typically used to hide an entire series).
        Parameters:
        series - the series index.
        item - the item index.
        Returns:
        A boolean.
      • isSeriesVisible

        boolean isSeriesVisible​(int series)
        Returns a boolean that indicates whether or not the specified series should be drawn (this is typically used to hide an entire series).
        Parameters:
        series - the series index.
        Returns:
        A boolean.
      • setSeriesVisible

        void setSeriesVisible​(int series,
                              Boolean visible,
                              boolean notify)
        Sets the flag that controls whether a series is visible and, if requested, sends a RendererChangeEvent to all registered listeners.
        Parameters:
        series - the series index.
        visible - the flag (null permitted).
        notify - notify listeners?
        See Also:
        getSeriesVisible(int)
      • isSeriesVisibleInLegend

        boolean isSeriesVisibleInLegend​(int series)
        Returns true if the series should be shown in the legend, and false otherwise.
        Parameters:
        series - the series index.
        Returns:
        A boolean.
      • setSeriesVisibleInLegend

        void setSeriesVisibleInLegend​(int series,
                                      Boolean visible,
                                      boolean notify)
        Sets the flag that controls whether a series is visible in the legend and, if requested, sends a RendererChangeEvent to all registered listeners.
        Parameters:
        series - the series index.
        visible - the flag (null permitted).
        notify - notify listeners?
        See Also:
        getSeriesVisibleInLegend(int)
      • getItemPaint

        Paint getItemPaint​(int row,
                           int column)
        Returns the paint used to color data items as they are drawn.
        Parameters:
        row - the row (or series) index (zero-based).
        column - the column (or category) index (zero-based).
        Returns:
        The paint (never null).
      • getSeriesPaint

        Paint getSeriesPaint​(int series)
        Returns the paint used to color an item drawn by the renderer.
        Parameters:
        series - the series index (zero-based).
        Returns:
        The paint (possibly null).
        See Also:
        setSeriesPaint(int, Paint)
      • setSeriesPaint

        void setSeriesPaint​(int series,
                            Paint paint,
                            boolean notify)
        Sets the paint used for a series and sends a RendererChangeEvent to all registered listeners if requested.
        Parameters:
        series - the series index (zero-based).
        paint - the paint (null permitted).
        notify - send a change event?
        See Also:
        getSeriesPaint(int)
      • setDefaultPaint

        void setDefaultPaint​(Paint paint,
                             boolean notify)
        Sets the default paint and sends a RendererChangeEvent to all registered listeners if requested.
        Parameters:
        paint - the paint (null not permitted).
        notify - send a change event?
        See Also:
        getDefaultPaint()
      • getItemFillPaint

        Paint getItemFillPaint​(int row,
                               int column)
        Returns the paint used to fill data items as they are drawn.
        Parameters:
        row - the row (or series) index (zero-based).
        column - the column (or category) index (zero-based).
        Returns:
        The paint (never null).
      • getSeriesFillPaint

        Paint getSeriesFillPaint​(int series)
        Returns the paint used to fill an item drawn by the renderer.
        Parameters:
        series - the series index (zero-based).
        Returns:
        The paint (possibly null).
      • setSeriesFillPaint

        void setSeriesFillPaint​(int series,
                                Paint paint)
        Sets the paint used for a series and sends a RendererChangeEvent to all registered listeners.
        Parameters:
        series - the series index (zero-based).
        paint - the paint (null permitted).
      • setSeriesFillPaint

        void setSeriesFillPaint​(int series,
                                Paint paint,
                                boolean notify)
        Sets the paint used for a series and sends a RendererChangeEvent to all registered listeners if requested.
        Parameters:
        series - the series index (zero-based).
        paint - the paint (null permitted).
        notify - send a change event?
      • setDefaultFillPaint

        void setDefaultFillPaint​(Paint paint,
                                 boolean notify)
        Sets the default paint and sends a RendererChangeEvent to all registered listeners if requested.
        Parameters:
        paint - the paint (null not permitted).
        notify - send a change event?
      • getItemOutlinePaint

        Paint getItemOutlinePaint​(int row,
                                  int column)
        Returns the paint used to outline data items as they are drawn.
        Parameters:
        row - the row (or series) index (zero-based).
        column - the column (or category) index (zero-based).
        Returns:
        The paint (never null).
      • setSeriesOutlinePaint

        void setSeriesOutlinePaint​(int series,
                                   Paint paint,
                                   boolean notify)
        Sets the paint used for a series outline and sends a RendererChangeEvent to all registered listeners if requested.
        Parameters:
        series - the series index (zero-based).
        paint - the paint (null permitted).
        notify - send a change event?
        See Also:
        getSeriesOutlinePaint(int)
      • getItemStroke

        Stroke getItemStroke​(int row,
                             int column)
        Returns the stroke used to draw data items.
        Parameters:
        row - the row (or series) index (zero-based).
        column - the column (or category) index (zero-based).
        Returns:
        The stroke (never null).
      • setSeriesStroke

        void setSeriesStroke​(int series,
                             Stroke stroke,
                             boolean notify)
        Sets the stroke used for a series and sends a RendererChangeEvent to all registered listeners if requested.
        Parameters:
        series - the series index (zero-based).
        stroke - the stroke (null permitted).
        notify - send a change event?
        See Also:
        getSeriesStroke(int)
      • getItemOutlineStroke

        Stroke getItemOutlineStroke​(int row,
                                    int column)
        Returns the stroke used to outline data items. The default implementation passes control to the lookupSeriesOutlineStroke method. You can override this method if you require different behaviour.
        Parameters:
        row - the row (or series) index (zero-based).
        column - the column (or category) index (zero-based).
        Returns:
        The stroke (never null).
      • setSeriesOutlineStroke

        void setSeriesOutlineStroke​(int series,
                                    Stroke stroke,
                                    boolean notify)
        Sets the outline stroke used for a series and sends a RendererChangeEvent to all registered listeners if requested.
        Parameters:
        series - the series index (zero-based).
        stroke - the stroke (null permitted).
        notify - send a change event?
        See Also:
        getSeriesOutlineStroke(int)
      • getItemShape

        Shape getItemShape​(int row,
                           int column)
        Returns a shape used to represent a data item.
        Parameters:
        row - the row (or series) index (zero-based).
        column - the column (or category) index (zero-based).
        Returns:
        The shape (never null).
      • getSeriesShape

        Shape getSeriesShape​(int series)
        Returns a shape used to represent the items in a series.
        Parameters:
        series - the series (zero-based index).
        Returns:
        The shape (possibly null).
        See Also:
        setSeriesShape(int, Shape)
      • setSeriesShape

        void setSeriesShape​(int series,
                            Shape shape,
                            boolean notify)
        Sets the shape used for a series and sends a RendererChangeEvent to all registered listeners if requested.
        Parameters:
        series - the series index (zero-based).
        shape - the shape (null permitted).
        notify - send a change event?
        See Also:
        getSeriesShape(int)
      • setDefaultShape

        void setDefaultShape​(Shape shape,
                             boolean notify)
        Sets the default shape and sends a RendererChangeEvent to all registered listeners if requested.
        Parameters:
        shape - the shape (null not permitted).
        notify - send a change event?
        See Also:
        getDefaultShape()
      • getLegendItem

        org.jfree.chart.legend.LegendItem getLegendItem​(int datasetIndex,
                                                        int series)
        Returns a legend item for a series from a dataset.
        Parameters:
        datasetIndex - the dataset index.
        series - the series (zero-based index).
        Returns:
        The legend item (possibly null).
      • getToolTipGenerator

        XYToolTipGenerator getToolTipGenerator​(int row,
                                               int column)
        Returns the tool tip generator for a data item.
        Parameters:
        row - the row index (zero based).
        column - the column index (zero based).
        Returns:
        The generator (possibly null).
      • setURLGenerator

        void setURLGenerator​(XYURLGenerator urlGenerator)
        Sets the URL generator for HTML image maps.
        Parameters:
        urlGenerator - the URL generator (null permitted).
      • isItemLabelVisible

        boolean isItemLabelVisible​(int row,
                                   int column)
        Returns true if an item label is visible, and false otherwise.
        Parameters:
        row - the row index (zero-based).
        column - the column index (zero-based).
        Returns:
        A boolean.
      • isSeriesItemLabelsVisible

        boolean isSeriesItemLabelsVisible​(int series)
        Returns true if the item labels for a series are visible, and false otherwise.
        Parameters:
        series - the series index (zero-based).
        Returns:
        A boolean.
      • setSeriesItemLabelsVisible

        void setSeriesItemLabelsVisible​(int series,
                                        Boolean visible,
                                        boolean notify)
        Sets the visibility of item labels for a series and, if requested, sends a RendererChangeEvent to all registered listeners.
        Parameters:
        series - the series index (zero-based).
        visible - the visible flag.
        notify - a flag that controls whether or not listeners are notified.
        See Also:
        isSeriesItemLabelsVisible(int)
      • getItemLabelGenerator

        XYItemLabelGenerator getItemLabelGenerator​(int row,
                                                   int column)
        Returns the item label generator for a data item.
        Parameters:
        row - the row index (zero based).
        column - the column index (zero based).
        Returns:
        The generator (possibly null).
      • getItemLabelFont

        Font getItemLabelFont​(int row,
                              int column)
        Returns the font for an item label.
        Parameters:
        row - the row index (zero-based).
        column - the column index (zero-based).
        Returns:
        The font (never null).
      • getSeriesItemLabelFont

        Font getSeriesItemLabelFont​(int series)
        Returns the font for all the item labels in a series.
        Parameters:
        series - the series index (zero-based).
        Returns:
        The font (possibly null).
      • getItemLabelPaint

        Paint getItemLabelPaint​(int row,
                                int column)
        Returns the paint used to draw an item label.
        Parameters:
        row - the row index (zero based).
        column - the column index (zero based).
        Returns:
        The paint (never null).
      • getPositiveItemLabelPosition

        ItemLabelPosition getPositiveItemLabelPosition​(int row,
                                                       int column)
        Returns the item label position for positive values.
        Parameters:
        row - the row index (zero-based).
        column - the column index (zero-based).
        Returns:
        The item label position (never null).
      • getSeriesPositiveItemLabelPosition

        ItemLabelPosition getSeriesPositiveItemLabelPosition​(int series)
        Returns the item label position for all positive values in a series.
        Parameters:
        series - the series index (zero-based).
        Returns:
        The item label position (never null).
      • setSeriesPositiveItemLabelPosition

        void setSeriesPositiveItemLabelPosition​(int series,
                                                ItemLabelPosition position,
                                                boolean notify)
        Sets the item label position for all positive values in a series and (if requested) sends a RendererChangeEvent to all registered listeners.
        Parameters:
        series - the series index (zero-based).
        position - the position (null permitted).
        notify - notify registered listeners?
      • getNegativeItemLabelPosition

        ItemLabelPosition getNegativeItemLabelPosition​(int row,
                                                       int column)
        Returns the item label position for negative values. This method can be overridden to provide customisation of the item label position for individual data items.
        Parameters:
        row - the row index (zero-based).
        column - the column (zero-based).
        Returns:
        The item label position (never null).
      • getSeriesNegativeItemLabelPosition

        ItemLabelPosition getSeriesNegativeItemLabelPosition​(int series)
        Returns the item label position for all negative values in a series.
        Parameters:
        series - the series index (zero-based).
        Returns:
        The item label position (never null).
      • setSeriesNegativeItemLabelPosition

        void setSeriesNegativeItemLabelPosition​(int series,
                                                ItemLabelPosition position,
                                                boolean notify)
        Sets the item label position for negative values in a series and (if requested) sends a RendererChangeEvent to all registered listeners.
        Parameters:
        series - the series index (zero-based).
        position - the position (null permitted).
        notify - notify registered listeners?
      • getItemCreateEntity

        boolean getItemCreateEntity​(int series,
                                    int item)
        Returns true if an entity should be created for an item, and false otherwise.
        Parameters:
        series - the series.
        item - the item.
        Returns:
        A boolean.
      • getSeriesCreateEntities

        Boolean getSeriesCreateEntities​(int series)
        Returns true if entities should be created for a series, and false otherwise. This method can return null in which case the renderering framework will look at the default setting.
        Parameters:
        series - the series.
        Returns:
        A boolean.
      • setSeriesCreateEntities

        void setSeriesCreateEntities​(int series,
                                     Boolean create)
        Sets a flag that specifies whether or not entities should be created for a series during rendering, and sends a change event to registered listeners.
        Parameters:
        series - the series.
        create - the flag value (null permitted).
      • setSeriesCreateEntities

        void setSeriesCreateEntities​(int series,
                                     Boolean create,
                                     boolean notify)
        Sets a flag that specifies whether or not entities should be created for a series during rendering, and sends a change event to registered listeners.
        Parameters:
        series - the series.
        create - the flag value (null permitted).
        notify - send a change event?
      • getDefaultCreateEntities

        boolean getDefaultCreateEntities()
        Returns the default value determining whether or not entities should be created by the renderer.
        Returns:
        A boolean.
      • setDefaultCreateEntities

        void setDefaultCreateEntities​(boolean create)
        Sets the default value determining whether or not entities should be created by the renderer, and sends a change event to all registered listeners.
        Parameters:
        create - the flag value.
      • setDefaultCreateEntities

        void setDefaultCreateEntities​(boolean create,
                                      boolean notify)
        Sets the default value determining whether or not entities should be created by the renderer, and sends a change event to all registered listeners.
        Parameters:
        create - the flag value.
        notify - notify listeners?
      • addAnnotation

        void addAnnotation​(XYAnnotation annotation)
        Adds an annotation and sends a RendererChangeEvent to all registered listeners. The annotation is added to the foreground layer.
        Parameters:
        annotation - the annotation (null not permitted).
      • addAnnotation

        void addAnnotation​(XYAnnotation annotation,
                           Layer layer)
        Adds an annotation to the specified layer.
        Parameters:
        annotation - the annotation (null not permitted).
        layer - the layer (null not permitted).
      • removeAnnotation

        boolean removeAnnotation​(XYAnnotation annotation)
        Removes the specified annotation and sends a RendererChangeEvent to all registered listeners.
        Parameters:
        annotation - the annotation to remove (null not permitted).
        Returns:
        A boolean to indicate whether or not the annotation was successfully removed.
      • drawAnnotations

        void drawAnnotations​(Graphics2D g2,
                             Rectangle2D dataArea,
                             ValueAxis domainAxis,
                             ValueAxis rangeAxis,
                             Layer layer,
                             PlotRenderingInfo info)
        Draws all the annotations for the specified layer.
        Parameters:
        g2 - the graphics device.
        dataArea - the data area.
        domainAxis - the domain axis.
        rangeAxis - the range axis.
        layer - the layer.
        info - the plot rendering info.
      • initialise

        XYItemRendererState initialise​(Graphics2D g2,
                                       Rectangle2D dataArea,
                                       XYPlot plot,
                                       XYDataset dataset,
                                       PlotRenderingInfo info)
        Initialises the renderer then returns the number of 'passes' through the data that the renderer will require (usually just one). This method will be called before the first item is rendered, giving the renderer an opportunity to initialise any state information it wants to maintain. The renderer can do nothing if it chooses.
        Parameters:
        g2 - the graphics device.
        dataArea - the area inside the axes.
        plot - the plot.
        dataset - the dataset.
        info - an optional info collection object to return data back to the caller.
        Returns:
        The number of passes the renderer requires.
      • drawItem

        void drawItem​(Graphics2D g2,
                      XYItemRendererState state,
                      Rectangle2D dataArea,
                      PlotRenderingInfo info,
                      XYPlot plot,
                      ValueAxis domainAxis,
                      ValueAxis rangeAxis,
                      XYDataset dataset,
                      int series,
                      int item,
                      CrosshairState crosshairState,
                      int pass)
        Called for each item to be plotted.

        The XYPlot can make multiple passes through the dataset, depending on the value returned by the renderer's initialise() method.

        Parameters:
        g2 - the graphics device.
        state - the renderer state.
        dataArea - the area within which the data is being rendered.
        info - collects drawing info.
        plot - the plot (can be used to obtain standard color information etc).
        domainAxis - the domain axis.
        rangeAxis - the range axis.
        dataset - the dataset.
        series - the series index (zero-based).
        item - the item index (zero-based).
        crosshairState - crosshair information for the plot (null permitted).
        pass - the pass index.
      • fillDomainGridBand

        void fillDomainGridBand​(Graphics2D g2,
                                XYPlot plot,
                                ValueAxis axis,
                                Rectangle2D dataArea,
                                double start,
                                double end)
        Fills a band between two values on the axis. This can be used to color bands between the grid lines.
        Parameters:
        g2 - the graphics device.
        plot - the plot.
        axis - the domain axis.
        dataArea - the data area.
        start - the start value.
        end - the end value.
      • fillRangeGridBand

        void fillRangeGridBand​(Graphics2D g2,
                               XYPlot plot,
                               ValueAxis axis,
                               Rectangle2D dataArea,
                               double start,
                               double end)
        Fills a band between two values on the range axis. This can be used to color bands between the grid lines.
        Parameters:
        g2 - the graphics device.
        plot - the plot.
        axis - the range axis.
        dataArea - the data area.
        start - the start value.
        end - the end value.
      • drawDomainLine

        void drawDomainLine​(Graphics2D g2,
                            XYPlot plot,
                            ValueAxis axis,
                            Rectangle2D dataArea,
                            double value,
                            Paint paint,
                            Stroke stroke)
        Draws a grid line against the domain axis.
        Parameters:
        g2 - the graphics device.
        plot - the plot.
        axis - the value axis.
        dataArea - the area for plotting data.
        value - the value.
        paint - the paint (null not permitted).
        stroke - the stroke (null not permitted).
      • drawRangeLine

        void drawRangeLine​(Graphics2D g2,
                           XYPlot plot,
                           ValueAxis axis,
                           Rectangle2D dataArea,
                           double value,
                           Paint paint,
                           Stroke stroke)
        Draws a line perpendicular to the range axis.
        Parameters:
        g2 - the graphics device.
        plot - the plot.
        axis - the value axis.
        dataArea - the area for plotting data.
        value - the data value.
        paint - the paint (null not permitted).
        stroke - the stroke (null not permitted).
      • drawDomainMarker

        void drawDomainMarker​(Graphics2D g2,
                              XYPlot plot,
                              ValueAxis axis,
                              Marker marker,
                              Rectangle2D dataArea)
        Draws the specified marker against the domain axis.
        Parameters:
        g2 - the graphics device.
        plot - the plot.
        axis - the value axis.
        marker - the marker.
        dataArea - the axis data area.
      • drawRangeMarker

        void drawRangeMarker​(Graphics2D g2,
                             XYPlot plot,
                             ValueAxis axis,
                             Marker marker,
                             Rectangle2D dataArea)
        Draws a horizontal line across the chart to represent a 'range marker'.
        Parameters:
        g2 - the graphics device.
        plot - the plot.
        axis - the value axis.
        marker - the marker line.
        dataArea - the axis data area.