Solved

JFreeChart: Fill in XYPlot

Posted on 2011-02-21
6
1,354 Views
Last Modified: 2012-05-11
Two images, first is what I have, second is what I want.
This is an XYPlot with 5 XYSeries (a sine function and 4 lines).
How do I fill in an area as shown in the second image.
Assume I know the 4 (x,y) coordinates defining the parallelogram.
 first fill
0
Comment
Question by:allelopath
[X]
Welcome to Experts Exchange

Add your voice to the tech community where 5M+ people just like you are talking about what matters.

  • Help others & share knowledge
  • Earn cash & points
  • Learn & ask questions
6 Comments
 
LVL 27

Expert Comment

by:mrcoffee365
ID: 34945815
I believe that this sort of thing is done with overlaying 2 plots.  The second one would only have the fill in the section you want.
0
 
LVL 47

Accepted Solution

by:
for_yan earned 250 total points
ID: 34945914
In JFreeChart there is an AreaChart wich would fill in with some color
area under the chartlike in this example:
http://www.roseindia.net/chartgraphs/area-chart.shtml
But in this case does not seem to be very simple to use it.
Maybe there is something more suimple in JFreeChart, another option is to combine
JFreeChart with Graphics2d - which can be done
combining the info in these two simple
examples:

You can fill in any area/path in Graphics2D:
http://stackoverflow.com/questions/3657460/fill-an-area-inside-two-cubiccurve2d-float-s-and-a-line

And you can combine it with waht you drew in JFreeChart:
http://stackoverflow.com/questions/4196853/decorating-a-jfreechart

There probably should be something more simple within JFreeChart.







0
 
LVL 1

Author Comment

by:allelopath
ID: 34946175
Thinking about this more. What I would ultimately like is as below. Basically, its an area bounded by functions. One function is the sine wave, Two are the diagonal lines and the last is just the bottom of the chart. I could create a horizontal line function to bound the bottom. So the question really is:

How do I fill in an area whose boundary is defined by a set of functions?

chart-fill.png
0
Technology Partners: We Want Your Opinion!

We value your feedback.

Take our survey and automatically be enter to win anyone of the following:
Yeti Cooler, Amazon eGift Card, and Movie eGift Card!

 
LVL 47

Expert Comment

by:for_yan
ID: 34946244
With Graphics2D you still can do it even if you will want to create
a sufficient number of points on the sine part of the path to make sure it looks nice.

Can you do it with JFreeChart?
0
 
LVL 92

Assisted Solution

by:objects
objects earned 250 total points
ID: 34947101
0
 
LVL 1

Author Comment

by:allelopath
ID: 35047048
I haven't had time to work on this. I will close the question and post again if need be.
0

Featured Post

Online Training Solution

Drastically shorten your training time with WalkMe's advanced online training solution that Guides your trainees to action. Forget about retraining and skyrocket knowledge retention rates.

Question has a verified solution.

If you are experiencing a similar issue, please ask a related question

Suggested Solutions

Title # Comments Views Activity
JavaFX TableView not displaying correctly 3 162
What browser will run Java? 7 180
Html split(text) 2 49
listing all the respondents to a twitter feed - Java 5 48
After being asked a question last year, I went into one of my moods where I did some research and code just for the fun and learning of it all.  Subsequently, from this journey, I put together this article on "Range Searching Using Visual Basic.NET …
Java contains several comparison operators (e.g., <, <=, >, >=, ==, !=) that allow you to compare primitive values. However, these operators cannot be used to compare the contents of objects. Interface Comparable is used to allow objects of a cl…
The viewer will learn how to implement Singleton Design Pattern in Java.
This tutorial explains how to use the VisualVM tool for the Java platform application. This video goes into detail on the Threads, Sampler, and Profiler tabs.
Suggested Courses

751 members asked questions and received personalized solutions in the past 7 days.

Join the community of 500,000 technology professionals and ask your questions.

Join & Ask a Question