Solved

JFreeChart: Fill in XYPlot

Posted on 2011-02-21
6
1,260 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
6 Comments
 
LVL 26

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
How to improve team productivity

Quip adds documents, spreadsheets, and tasklists to your Slack experience
- Elevate ideas to Quip docs
- Share Quip docs in Slack
- Get notified of changes to your docs
- Available on iOS/Android/Desktop/Web
- Online/Offline

 
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

What Security Threats Are You Missing?

Enhance your security with threat intelligence from the web. Get trending threat insights on hackers, exploits, and suspicious IP addresses delivered to your inbox with our free Cyber Daily.

Join & Write a Comment

Suggested Solutions

Title # Comments Views Activity
copyEndy  challenge 15 55
scoresSpecial  challenge 13 40
Performance issue while iterating with streams 5 39
json example 39 113
For customizing the look of your lightweight component and making it look opaque like it was made of plastic.  This tip assumes your component to be of rectangular shape and completely opaque.   (CODE)
Introduction This article is the last of three articles that explain why and how the Experts Exchange QA Team does test automation for our web site. This article covers our test design approach and then goes through a simple test case example, how …
Viewers learn about the “for” loop and how it works in Java. By comparing it to the while loop learned before, viewers can make the transition easily. You will learn about the formatting of the for loop as we write a program that prints even numbers…
Video by: Michael
Viewers learn about how to reduce the potential repetitiveness of coding in main by developing methods to perform specific tasks for their program. Additionally, objects are introduced for the purpose of learning how to call methods in Java. Define …

706 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

Need Help in Real-Time?

Connect with top rated Experts

13 Experts available now in Live!

Get 1:1 Help Now