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 8365773
In Process

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: June 9, 20262026-06-09T12:44:28+00:00 2026-06-09T12:44:28+00:00

JFreeChart has a class called LineFunction2D(double YIntercept, double Slope) . I can get the

  • 0

JFreeChart has a class called LineFunction2D(double YIntercept, double Slope). I can get the JFreeChart examples to work, but I can’t get LineFunction2D to work. How can I add the line graph to a JFreeChart object?

LineFunction2D line = new LineFunction2D(.03125, (.125 - .03125));

//missing code goes here

JFreeChart chart = new JFreeChart(Plot plot);
ChartPanel panel = new ChartPanel(chart);

Thanks!

(I’m working on the sscce, and will post it soon.)

  • 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-06-09T12:44:30+00:00Added an answer on June 9, 2026 at 12:44 pm

    I think that the code you are looking for is the call to DatasetUtilities.sampleFunction2D to convert the dataset into am XYDataset that you can add to your plot

    private static final double A = 5 / 16d;
    private static final double B = 1 / 8d - A;
    private double start = 1;
    private double end = 10;
    private int samples = 4;
    private Comparable<String> seriesKey = "Regression";
    

    …

            XYPlot plot = new XYPlot(this.data1, xAxis, yAxis, renderer1);
            LineFunction2D line = new LineFunction2D(A, B);
            XYDataset lineDS = DatasetUtilities.sampleFunction2D(line,start,end,samples,seriesKey );
            plot.setDataset(plot.getDatasetCount() + 1, lineDS);
    
    • 0
    • Reply
    • Share
      Share
      • Share on Facebook
      • Share on Twitter
      • Share on LinkedIn
      • Share on WhatsApp
      • Report

Sidebar

Related Questions

Does JFreeChart work on Blackberry? (Just want to get a quick answer before I
How can I implement the double domain cross-hairs for my jfreechart? Here is the
Can I add a scroll bar to the JFreeChart that allows me horizontally move
I want to make my chart printible. I know JFreeChart already has a print
I am working with JFreeChart to create a line graph via an XYPlot which
I'm currently using JFreeChart, but the the end of my plot doesn't intersect with
I'm using JFreeChart to create a chart that has 6 TimeSeries in it. Problem
I use Jfreechart's bar chart to show data. But in case all data is
Ok, I know about JFreeChart and others, but I'm coding my own simple scatter
Has anyone worked with JFreeChart-open source library for plotting xy plots? Could someone post

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.