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

  • SEARCH
  • Home
  • 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 6110505
In Process

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: May 23, 20262026-05-23T14:31:25+00:00 2026-05-23T14:31:25+00:00

I have 2 questions 1)I am trying to draw an arc on an XYplot

  • 0

I have 2 questions

1)I am trying to draw an arc on an XYplot using the shape annotation. I used the XYLine annotation to draw a line and I want the arc to start where the line ends. I am having some issues with the parameters.I want the arc to have a height of 17, width 44, and start at the point(3.0, 17) of the plot(this is where the line ends). But the code below does not work. Can someone please tell me what is wrong with the code?

Arc2D.Double arc = new Arc2D.Double(3.0, 
                        16.9,
                        44.0,
                        17.04, 
                        180.0,
                        180.0,
                        Arc2D.OPEN 
                );
plot.addAnnotation(new XYShapeAnnotation(arc,
                        new BasicStroke(2.0f), Color.white));
XYLineAnnotation a1 = new XYLineAnnotation(3.0, 0.0, 3.0,
                        16.9, new BasicStroke(2.0f), Color.white);

2)How can I draw a similar figure on a polar plot?

Thanks

  • 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-23T14:31:25+00:00Added an answer on May 23, 2026 at 2:31 pm
    1. The critical thing about Arc2D is the bounding rectangle. To make the half-arc H units high, the bounds must be 2 * H units high.

    2. AFAIK, PolarPlot does not support annotations.

    enter image description here

    import java.awt.BasicStroke;
    import java.awt.Color;
    import java.awt.geom.Arc2D;
    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.data.xy.XYDataset;
    import org.jfree.data.xy.XYSeries;
    import org.jfree.data.xy.XYSeriesCollection;
    
    /** @see http://stackoverflow.com/questions/6604211 */
    public class ArcTest {
    
        private static final Random r = new Random();
        private static final double PI = 180d;
        private static final int X = 3;
        private static final int Y = 0;
        private static final int W = 44;
        private static final int H = 17;
    
        public static void main(String[] args) {
            JFreeChart chart = ChartFactory.createXYLineChart(
                "ArcTest", "X", "Y", createDataset(),
                PlotOrientation.VERTICAL, true, true, false);
            XYPlot plot = chart.getXYPlot();
            XYLineAnnotation line = new XYLineAnnotation(
                X, Y, X, H, new BasicStroke(2f), Color.blue);
            plot.addAnnotation(line);
            Arc2D.Double arc = new Arc2D.Double(
                X, Y, W, 2 * H, PI, PI, Arc2D.OPEN);
            plot.addAnnotation(new XYShapeAnnotation(arc,
                new BasicStroke(2.0f), Color.blue));
            ChartFrame frame = new ChartFrame("First", 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(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

I am trying to draw a Google Line Chart, where each line may have
I have two questions. (First) I'm trying to make it where whenever the iPhone
I am trying to think data in terms of sets but have some questions
I'm trying to design a small game using C# and XNA, before I start
I have seen other questions about this and I've tried using Alpha and imagetruecolortopalette
I'm trying to draw a line between two (2D) points when the user swipes
New to Python, have a simple, situational question: Trying to use BeautifulSoup to parse
I have a question about some functionality I'm trying to add to my jQuery
I have a question about reflection I am trying to have some kind of
I have a question related to this one : I'm trying to attach an

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.