Sign Up

Sign Up to our social questions and Answers Engine to ask questions, answer people’s questions, and connect with other people.

Have an account? Sign In

Have an account? Sign In Now

Sign In

Login to our social questions & Answers Engine to ask questions answer people’s questions & connect with other people.

Sign Up Here

Forgot Password?

Don't have account, Sign Up Here

Forgot Password

Lost your password? Please enter your email address. You will receive a link and will create a new password via email.

Have an account? Sign In Now

You must login to ask a question.

Forgot Password?

Need An Account, Sign Up Here

Please briefly explain why you feel this question should be reported.

Please briefly explain why you feel this answer should be reported.

Please briefly explain why you feel this user should be reported.

Sign InSign Up

The Archive Base

The Archive Base Logo The Archive Base Logo

The Archive Base Navigation

  • Home
  • SEARCH
  • About Us
  • Blog
  • Contact Us
Search
Ask A Question

Mobile menu

Close
Ask a Question
  • Home
  • Add group
  • Groups page
  • Feed
  • User Profile
  • Communities
  • Questions
    • New Questions
    • Trending Questions
    • Must read Questions
    • Hot Questions
  • Polls
  • Tags
  • Badges
  • Buy Points
  • Users
  • Help
  • Buy Theme
  • SEARCH
Home/ Questions/Q 6201283
In Process

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: May 24, 20262026-05-24T04:31:29+00:00 2026-05-24T04:31:29+00:00

I have an XYPlot on which are series and a couple of dynamically added

  • 0

I have an XYPlot on which are series and a couple of dynamically added shape annotations with no fill (hence each of the series points are visible). Is it possible to display the series tool tips(that show the coordinate of the series point over which the mouse pointer is currently pointing to) over the annotations? Or how can I re-arrange the elements in order to make the tooltip visible.

  • 1 1 Answer
  • 0 Views
  • 0 Followers
  • 0
Share
  • Facebook
  • Report

Leave an answer
Cancel reply

You must login to add an answer.

Forgot Password?

Need An Account, Sign Up Here

1 Answer

  • Voted
  • Oldest
  • Recent
  • Random
  1. Editorial Team
    Editorial Team
    2026-05-24T04:31:30+00:00Added an answer on May 24, 2026 at 4:31 am

    I suspect you are adding the shape annotations to the plot, where they are drawn last. Instead, add them to the renderer in Layer.BACKGROUND. As shown below, the circle does not obscure the tool tip at (20, 20). Note also how (10, 10) is not affected by the line annotation, while (30, 30) is obscured by the arc.

    image

    import java.awt.BasicStroke;
    import java.awt.Color;
    import java.awt.geom.Arc2D;
    import java.awt.geom.Ellipse2D;
    import java.util.Random;
    import org.jfree.chart.ChartFactory;
    import org.jfree.chart.ChartFrame;
    import org.jfree.chart.JFreeChart;
    import org.jfree.chart.annotations.XYLineAnnotation;
    import org.jfree.chart.annotations.XYShapeAnnotation;
    import org.jfree.chart.plot.PlotOrientation;
    import org.jfree.chart.plot.XYPlot;
    import org.jfree.chart.renderer.xy.XYLineAndShapeRenderer;
    import org.jfree.data.xy.XYDataset;
    import org.jfree.data.xy.XYSeries;
    import org.jfree.data.xy.XYSeriesCollection;
    import org.jfree.ui.Layer;
    
    /**
     * @see http://stackoverflow.com/questions/6797012
     * @see http://stackoverflow.com/questions/6604211
     */
    public class ArcTest {
    
        private static final Random r = new Random();
        private static final Color blue = Color.blue;
        private static final BasicStroke stroke = new BasicStroke(2.0f);
        private static final double PI = 180d;
        private static final int X = 8;
        private static final int Y = 0;
        private static final int W = 6 * X;
        private static final int H = 3 * X;
    
        public static void main(String[] args) {
            JFreeChart chart = ChartFactory.createXYLineChart(
                "ArcTest", "X", "Y", createDataset(),
                PlotOrientation.VERTICAL, true, true, false);
            XYPlot plot = chart.getXYPlot();
    
            XYLineAndShapeRenderer renderer =
                (XYLineAndShapeRenderer) plot.getRenderer();
            renderer.setBaseShapesVisible(true);
            Ellipse2D.Double circle = new Ellipse2D.Double(X, X, 20, 20);
            renderer.addAnnotation(new XYShapeAnnotation(
                circle, stroke, blue), Layer.BACKGROUND);
    
            XYLineAnnotation line = new XYLineAnnotation(X, Y, X, H, stroke, blue);
            plot.addAnnotation(line);
            Arc2D.Double arc = new Arc2D.Double(X, Y, W, 2 * H, PI, PI, Arc2D.OPEN);
            plot.addAnnotation(new XYShapeAnnotation(arc, stroke, blue));
    
            ChartFrame frame = new ChartFrame("Test", chart);
            frame.pack();
            frame.setVisible(true);
        }
    
        private static XYDataset createDataset() {
            XYSeriesCollection result = new XYSeriesCollection();
            XYSeries series = new XYSeries("ArcTest");
            series.add(0, 0);
            series.add(10, 10);
            series.add(20, 20);
            series.add(30, 30);
            series.add(W, W);
            result.addSeries(series);
            return result;
        }
    }
    
    • 0
    • Reply
    • Share
      Share
      • Share on Facebook
      • Share on Twitter
      • Share on LinkedIn
      • Share on WhatsApp
      • Report

Sidebar

Related Questions

have written this little class, which generates a UUID every time an object of
Have a procedure which looks like Procedure TestProc(TVar1, TVar2 : variant); Begin TVar1 :=
Have deployed numerous report parts which reference the same view however one of them
A newbie question. (ADDED NEW INFO) I have a set of time stamped data
Maybe someone know how to solve this problem: I Have XY Plot with points
I have an application which updates a variable about between 5 to 50 times
have been trying couple of hours now to make my iphone app universal. The
I have created a xyplot with lattice library(lattice) X1=c(5, -2, 1, -3) X2=X1^2 names=paste(dot,
I have 2 questions 1)I am trying to draw an arc on an XYplot
I have thousands of points to Plot on a JFreeChart scatter plot. The problem

Explore

  • Home
  • Add group
  • Groups page
  • Communities
  • Questions
    • New Questions
    • Trending Questions
    • Must read Questions
    • Hot Questions
  • Polls
  • Tags
  • Badges
  • Users
  • Help
  • SEARCH

Footer

© 2021 The Archive Base. All Rights Reserved
With Love by The Archive Base

Insert/edit link

Enter the destination URL

Or link to existing content

    No search term specified. Showing recent items. Search or use up and down arrow keys to select an item.