Class BoxAndWhiskerRenderer

    • Field Detail

      • serialVersionUID

        private static final long serialVersionUID
        For serialization.
        See Also:
        Constant Field Values
      • artifactPaint

        private transient java.awt.Paint artifactPaint
        The color used to paint the median line and average marker.
      • fillBox

        private boolean fillBox
        A flag that controls whether or not the box is filled.
      • itemMargin

        private double itemMargin
        The margin between items (boxes) within a category.
      • maximumBarWidth

        private double maximumBarWidth
        The maximum bar width as percentage of the available space in the plot. Take care with the encoding - for example, 0.05 is five percent.
      • medianVisible

        private boolean medianVisible
        A flag that controls whether or not the median indicator is drawn.
      • meanVisible

        private boolean meanVisible
        A flag that controls whether or not the mean indicator is drawn.
      • maxOutlierVisible

        private boolean maxOutlierVisible
        A flag that controls whether or not the maxOutlier is visible.
      • minOutlierVisible

        private boolean minOutlierVisible
        A flag that controls whether or not the minOutlier is visible.
      • useOutlinePaintForWhiskers

        private boolean useOutlinePaintForWhiskers
        A flag that, if true, causes the whiskers to be drawn using the outline paint for the series. The default value is false and in that case the regular series paint is used.
      • whiskerWidth

        private double whiskerWidth
        The width of the whiskers as fraction of the bar width.
    • Constructor Detail

      • BoxAndWhiskerRenderer

        public BoxAndWhiskerRenderer()
        Default constructor.
    • Method Detail

      • getArtifactPaint

        public java.awt.Paint getArtifactPaint()
        Returns the paint used to color the median and average markers.
        Returns:
        The paint used to draw the median and average markers (never null).
        See Also:
        setArtifactPaint(Paint)
      • setArtifactPaint

        public void setArtifactPaint​(java.awt.Paint paint)
        Sets the paint used to color the median and average markers and sends a RendererChangeEvent to all registered listeners.
        Parameters:
        paint - the paint (null not permitted).
        See Also:
        getArtifactPaint()
      • getFillBox

        public boolean getFillBox()
        Returns the flag that controls whether or not the box is filled.
        Returns:
        A boolean.
        See Also:
        setFillBox(boolean)
      • setFillBox

        public void setFillBox​(boolean flag)
        Sets the flag that controls whether or not the box is filled and sends a RendererChangeEvent to all registered listeners.
        Parameters:
        flag - the flag.
        See Also:
        getFillBox()
      • getItemMargin

        public double getItemMargin()
        Returns the item margin. This is a percentage of the available space that is allocated to the space between items in the chart.
        Returns:
        The margin.
        See Also:
        setItemMargin(double)
      • setItemMargin

        public void setItemMargin​(double margin)
        Sets the item margin and sends a RendererChangeEvent to all registered listeners.
        Parameters:
        margin - the margin (a percentage).
        See Also:
        getItemMargin()
      • getMaximumBarWidth

        public double getMaximumBarWidth()
        Returns the maximum bar width as a percentage of the available drawing space. Take care with the encoding, for example 0.10 is ten percent.
        Returns:
        The maximum bar width.
        See Also:
        setMaximumBarWidth(double)
      • setMaximumBarWidth

        public void setMaximumBarWidth​(double percent)
        Sets the maximum bar width, which is specified as a percentage of the available space for all bars, and sends a RendererChangeEvent to all registered listeners.
        Parameters:
        percent - the maximum bar width (a percentage, where 0.10 is ten percent).
        See Also:
        getMaximumBarWidth()
      • isMeanVisible

        public boolean isMeanVisible()
        Returns the flag that controls whether or not the mean indicator is draw for each item.
        Returns:
        A boolean.
        See Also:
        setMeanVisible(boolean)
      • setMeanVisible

        public void setMeanVisible​(boolean visible)
        Sets the flag that controls whether or not the mean indicator is drawn for each item, and sends a RendererChangeEvent to all registered listeners.
        Parameters:
        visible - the new flag value.
        See Also:
        isMeanVisible()
      • isMedianVisible

        public boolean isMedianVisible()
        Returns the flag that controls whether or not the median indicator is draw for each item.
        Returns:
        A boolean.
        See Also:
        setMedianVisible(boolean)
      • setMedianVisible

        public void setMedianVisible​(boolean visible)
        Sets the flag that controls whether or not the median indicator is drawn for each item, and sends a RendererChangeEvent to all registered listeners.
        Parameters:
        visible - the new flag value.
        See Also:
        isMedianVisible()
      • isMinOutlierVisible

        public boolean isMinOutlierVisible()
        Returns the flag that controls whether or not the minimum outlier is draw for each item.
        Returns:
        A boolean.
        Since:
        1.5.2
        See Also:
        setMinOutlierVisible(boolean)
      • setMinOutlierVisible

        public void setMinOutlierVisible​(boolean visible)
        Sets the flag that controls whether or not the minimum outlier is drawn for each item, and sends a RendererChangeEvent to all registered listeners.
        Parameters:
        visible - the new flag value.
        Since:
        1.5.2
        See Also:
        isMinOutlierVisible()
      • isMaxOutlierVisible

        public boolean isMaxOutlierVisible()
        Returns the flag that controls whether or not the maximum outlier is draw for each item.
        Returns:
        A boolean.
        Since:
        1.5.2
        See Also:
        setMaxOutlierVisible(boolean)
      • setMaxOutlierVisible

        public void setMaxOutlierVisible​(boolean visible)
        Sets the flag that controls whether or not the maximum outlier is drawn for each item, and sends a RendererChangeEvent to all registered listeners.
        Parameters:
        visible - the new flag value.
        Since:
        1.5.2
        See Also:
        isMaxOutlierVisible()
      • getUseOutlinePaintForWhiskers

        public boolean getUseOutlinePaintForWhiskers()
        Returns the flag that, if true, causes the whiskers to be drawn using the series outline paint.
        Returns:
        A boolean.
      • setUseOutlinePaintForWhiskers

        public void setUseOutlinePaintForWhiskers​(boolean flag)
        Sets the flag that, if true, causes the whiskers to be drawn using the series outline paint, and sends a RendererChangeEvent to all registered listeners.
        Parameters:
        flag - the new flag value.
      • getWhiskerWidth

        public double getWhiskerWidth()
        Returns the width of the whiskers as fraction of the bar width.
        Returns:
        The width of the whiskers.
        See Also:
        setWhiskerWidth(double)
      • initialise

        public CategoryItemRendererState initialise​(java.awt.Graphics2D g2,
                                                    java.awt.geom.Rectangle2D dataArea,
                                                    CategoryPlot plot,
                                                    int rendererIndex,
                                                    PlotRenderingInfo info)
        Initialises the renderer. This method gets called once at the start of the process of drawing a chart.
        Specified by:
        initialise in interface CategoryItemRenderer
        Overrides:
        initialise in class AbstractCategoryItemRenderer
        Parameters:
        g2 - the graphics device.
        dataArea - the area in which the data is to be plotted.
        plot - the plot.
        rendererIndex - the renderer index.
        info - collects chart rendering information for return to caller.
        Returns:
        The renderer state.
      • drawItem

        public void drawItem​(java.awt.Graphics2D g2,
                             CategoryItemRendererState state,
                             java.awt.geom.Rectangle2D dataArea,
                             CategoryPlot plot,
                             CategoryAxis domainAxis,
                             ValueAxis rangeAxis,
                             CategoryDataset dataset,
                             int row,
                             int column,
                             int pass)
        Draw a single data item.
        Specified by:
        drawItem in interface CategoryItemRenderer
        Parameters:
        g2 - the graphics device.
        state - the renderer state.
        dataArea - the area in which the data is drawn.
        plot - the plot.
        domainAxis - the domain axis.
        rangeAxis - the range axis.
        dataset - the data (must be an instance of BoxAndWhiskerCategoryDataset).
        row - the row index (zero-based).
        column - the column index (zero-based).
        pass - the pass index.
      • drawHorizontalItem

        public void drawHorizontalItem​(java.awt.Graphics2D g2,
                                       CategoryItemRendererState state,
                                       java.awt.geom.Rectangle2D dataArea,
                                       CategoryPlot plot,
                                       CategoryAxis domainAxis,
                                       ValueAxis rangeAxis,
                                       CategoryDataset dataset,
                                       int row,
                                       int column)
        Draws the visual representation of a single data item when the plot has a horizontal orientation.
        Parameters:
        g2 - the graphics device.
        state - the renderer state.
        dataArea - the area within which the plot is being drawn.
        plot - the plot (can be used to obtain standard color information etc).
        domainAxis - the domain axis.
        rangeAxis - the range axis.
        dataset - the dataset (must be an instance of BoxAndWhiskerCategoryDataset).
        row - the row index (zero-based).
        column - the column index (zero-based).
      • drawVerticalItem

        public void drawVerticalItem​(java.awt.Graphics2D g2,
                                     CategoryItemRendererState state,
                                     java.awt.geom.Rectangle2D dataArea,
                                     CategoryPlot plot,
                                     CategoryAxis domainAxis,
                                     ValueAxis rangeAxis,
                                     CategoryDataset dataset,
                                     int row,
                                     int column)
        Draws the visual representation of a single data item when the plot has a vertical orientation.
        Parameters:
        g2 - the graphics device.
        state - the renderer state.
        dataArea - the area within which the plot is being drawn.
        plot - the plot (can be used to obtain standard color information etc).
        domainAxis - the domain axis.
        rangeAxis - the range axis.
        dataset - the dataset (must be an instance of BoxAndWhiskerCategoryDataset).
        row - the row index (zero-based).
        column - the column index (zero-based).
      • drawEllipse

        private void drawEllipse​(java.awt.geom.Point2D point,
                                 double oRadius,
                                 java.awt.Graphics2D g2)
        Draws a dot to represent an outlier.
        Parameters:
        point - the location.
        oRadius - the radius.
        g2 - the graphics device.
      • drawMultipleEllipse

        private void drawMultipleEllipse​(java.awt.geom.Point2D point,
                                         double boxWidth,
                                         double oRadius,
                                         java.awt.Graphics2D g2)
        Draws two dots to represent the average value of more than one outlier.
        Parameters:
        point - the location
        boxWidth - the box width.
        oRadius - the radius.
        g2 - the graphics device.
      • drawHighFarOut

        private void drawHighFarOut​(double aRadius,
                                    java.awt.Graphics2D g2,
                                    double xx,
                                    double m)
        Draws a triangle to indicate the presence of far-out values.
        Parameters:
        aRadius - the radius.
        g2 - the graphics device.
        xx - the x coordinate.
        m - the y coordinate.
      • drawLowFarOut

        private void drawLowFarOut​(double aRadius,
                                   java.awt.Graphics2D g2,
                                   double xx,
                                   double m)
        Draws a triangle to indicate the presence of far-out values.
        Parameters:
        aRadius - the radius.
        g2 - the graphics device.
        xx - the x coordinate.
        m - the y coordinate.
      • equals

        public boolean equals​(java.lang.Object obj)
        Tests this renderer for equality with an arbitrary object.
        Overrides:
        equals in class AbstractCategoryItemRenderer
        Parameters:
        obj - the object (null permitted).
        Returns:
        true or false.
      • writeObject

        private void writeObject​(java.io.ObjectOutputStream stream)
                          throws java.io.IOException
        Provides serialization support.
        Parameters:
        stream - the output stream.
        Throws:
        java.io.IOException - if there is an I/O error.
      • readObject

        private void readObject​(java.io.ObjectInputStream stream)
                         throws java.io.IOException,
                                java.lang.ClassNotFoundException
        Provides serialization support.
        Parameters:
        stream - the input stream.
        Throws:
        java.io.IOException - if there is an I/O error.
        java.lang.ClassNotFoundException - if there is a classpath problem.