permaculture playing cards*
The moose likes Other Open Source Projects and the fly likes Creating a Graph with a Trend Line Big Moose Saloon
  Search | Java FAQ | Recent Topics | Flagged Topics | Hot Topics | Zero Replies
Register / Login


Win a copy of Android Security Essentials Live Lessons this week in the Android forum!
JavaRanch » Java Forums » Products » Other Open Source Projects
Bookmark "Creating a Graph with a Trend Line" Watch "Creating a Graph with a Trend Line" New topic
Author

Creating a Graph with a Trend Line

Steve Dyke
Ranch Hand

Joined: Nov 16, 2004
Posts: 1393
I have a jFreeChart line chart that I would like to add a trend line to. I have searched but did not find much help on this subject. Can someone help me get this done?
Steve Dyke
Ranch Hand

Joined: Nov 16, 2004
Posts: 1393
I still need some help with this issue.
Ulf Dittmer
Marshal

Joined: Mar 22, 2005
Posts: 41134
    
  45
JFreeChart can only render the data it has been given - so you'll need to supply a Dataset that has the points of the trend line. At that point it'll simply be a chart with two X/Y lines.

Or were you looking for a way to have JFC calculate the trend automatically from a given Dataset? It doesn't have provisions for that.


Ping & DNS - my free Android networking tools app
Steve Dyke
Ranch Hand

Joined: Nov 16, 2004
Posts: 1393
Ulf Dittmer wrote:JFreeChart can only render the data it has been given - so you'll need to supply a Dataset that has the points of the trend line. At that point it'll simply be a chart with two X/Y lines.

Or were you looking for a way to have JFC calculate the trend automatically from a given Dataset? It doesn't have provisions for that.


Yes, I was hoping for JFC to do the work. But if it can't your first suggestion is the direction I will go.

Do you have any or can you direct me to any examples?
Ulf Dittmer
Marshal

Joined: Mar 22, 2005
Posts: 41134
    
  45
An example of an X/Y line chart with a dataset containing two lines can be found at http://faq.javaranch.com/java/JFreeChartDemo
Steve Dyke
Ranch Hand

Joined: Nov 16, 2004
Posts: 1393
Ulf Dittmer wrote:An example of an X/Y line chart with a dataset containing two lines can be found at http://faq.javaranch.com/java/JFreeChartDemo


I have created charts with multiple data sets. What I need an example of is the trend line calculation to provide the data points for the XY trend line.
Ulf Dittmer
Marshal

Joined: Mar 22, 2005
Posts: 41134
    
  45
I see. Then the question becomes, how do you define a trend - an n-point moving average? Or do you want to fit a curve through the data points?
Steve Dyke
Ranch Hand

Joined: Nov 16, 2004
Posts: 1393
Ulf Dittmer wrote:I see. Then the question becomes, how do you define a trend - an n-point moving average? Or do you want to fit a curve through the data points?


It was the moving average and with your help I have got what I need working. Thanks.
 
Consider Paul's rocket mass heater.
 
subject: Creating a Graph with a Trend Line
 
Similar Threads
WA #1.....word association
Is it true that there is NO or very little hiring in the last quarter of the year?
else block is not processed
How to implement TREND()
SpyWare virus