Class XYBezierRenderer

    • Field Detail

      • precision

        private int precision
        Resolution of Bezier curves (number of line segments between points)
      • tension

        private double tension
        Tension defines how sharply does the curve bends
      • fillType

        private XYBezierRenderer.FillType fillType
        A flag that can be set to specify to fill the area under the Bezier curve.
    • Constructor Detail

      • XYBezierRenderer

        public XYBezierRenderer()
        Creates a new instance with the precision attribute defaulting to 5, the tension attribute defaulting to 2 and no fill of the area 'under' the Bezier curve.
      • XYBezierRenderer

        public XYBezierRenderer​(int precision,
                                double tension)
        Creates a new renderer with the specified precision and tension and no fill of the area 'under' (between '0' and) the Bezier curve.
        Parameters:
        precision - the number of points between data items.
        tension - value to define how sharply the curve bends
      • XYBezierRenderer

        public XYBezierRenderer​(int precision,
                                double tension,
                                XYBezierRenderer.FillType fillType)
        Creates a new renderer with the specified precision and specified fill of the area 'under' (between '0' and) the Bezier curve.
        Parameters:
        precision - the number of points between data items.
        tension - value to define how sharply the Bezier curve bends
        fillType - the type of fill beneath the curve (null not permitted).
        Since:
        1.0.17
    • Method Detail

      • getPrecision

        public int getPrecision()
        Returns the number of line segments used to approximate the Bezier curve between data points.
        Returns:
        The number of line segments.
        See Also:
        setPrecision(int)
      • setPrecision

        public void setPrecision​(int p)
        Set the resolution of Bezier curves and sends a RendererChangeEvent to all registered listeners.
        Parameters:
        p - number of line segments between points (must be > 0).
        See Also:
        getPrecision()
      • getTension

        public double getTension()
        Returns the value of the tension which defines how sharply does the curve bends
        Returns:
        The value of tesion.
        See Also:
        setTension(double)
      • setTension

        public void setTension​(double t)
        Set the value of the tension which defines how sharply does the curve bends and sends a RendererChangeEvent to all registered listeners.
        Parameters:
        t - value of tension (must be > 0).
        See Also:
        getTension()
      • getGradientPaintTransformer

        public GradientPaintTransformer getGradientPaintTransformer()
        Returns the gradient paint transformer, or null.
        Returns:
        The gradient paint transformer (possibly null).
        Since:
        1.0.17
      • setGradientPaintTransformer

        public void setGradientPaintTransformer​(GradientPaintTransformer gpt)
        Sets the gradient paint transformer and sends a RendererChangeEvent to all registered listeners.
        Parameters:
        gpt - the transformer (null permitted).
        Since:
        1.0.17
      • initialise

        public XYItemRendererState initialise​(java.awt.Graphics2D g2,
                                              java.awt.geom.Rectangle2D dataArea,
                                              XYPlot plot,
                                              XYDataset data,
                                              PlotRenderingInfo info)
        Initialises the renderer.

        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.

        Specified by:
        initialise in interface XYItemRenderer
        Overrides:
        initialise in class XYLineAndShapeRenderer
        Parameters:
        g2 - the graphics device.
        dataArea - the area inside the axes.
        plot - the plot.
        data - the data.
        info - an optional info collection object to return data back to the caller.
        Returns:
        The renderer state.
      • drawPrimaryLineAsPath

        protected void drawPrimaryLineAsPath​(XYItemRendererState state,
                                             java.awt.Graphics2D g2,
                                             XYPlot plot,
                                             XYDataset dataset,
                                             int pass,
                                             int series,
                                             int item,
                                             ValueAxis xAxis,
                                             ValueAxis yAxis,
                                             java.awt.geom.Rectangle2D dataArea)
        Draws the item (first pass). This method draws the lines connecting the items. Instead of drawing separate lines, a GeneralPath is constructed and drawn at the end of the series painting.
        Overrides:
        drawPrimaryLineAsPath in class XYLineAndShapeRenderer
        Parameters:
        g2 - the graphics device.
        state - the renderer state.
        plot - the plot (can be used to obtain standard color information etc).
        dataset - the dataset.
        pass - the pass.
        series - the series index (zero-based).
        item - the item index (zero-based).
        xAxis - the domain axis.
        yAxis - the range axis.
        dataArea - the area within which the data is being drawn.
      • addBezierPointsToSeriesPath

        private void addBezierPointsToSeriesPath​(java.awt.geom.Point2D[] segmentPoints,
                                                 XYBezierRenderer.XYBezierState s)
      • calculateSegmentPoints

        private java.awt.geom.Point2D[] calculateSegmentPoints​(java.awt.geom.Point2D[] original4Points)
      • calcSegmentPointsInitial

        private java.awt.geom.Point2D[] calcSegmentPointsInitial​(java.awt.geom.Point2D[] original3P)
      • calcSegmentPointsFinal

        private java.awt.geom.Point2D[] calcSegmentPointsFinal​(java.awt.geom.Point2D[] original3P)
      • calcUnitaryVector

        private java.awt.geom.Point2D calcUnitaryVector​(java.awt.geom.Point2D pOrigin,
                                                        java.awt.geom.Point2D pEnd)
      • equals

        public boolean equals​(java.lang.Object obj)
        Tests this renderer for equality with an arbitrary object.
        Overrides:
        equals in class XYLineAndShapeRenderer
        Parameters:
        obj - the object (null permitted).
        Returns:
        A boolean.