Solved

JFreeChart: Fill in XYPlot

Posted on 2011-02-21
6
1,313 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 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
Networking for the Cloud Era

Join Microsoft and Riverbed for a discussion and demonstration of enhancements to SteelConnect:
-One-click orchestration and cloud connectivity in Azure environments
-Tight integration of SD-WAN and WAN optimization capabilities
-Scalability and resiliency equal to a data center

 
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

Free Tool: Site Down Detector

Helpful to verify reports of your own downtime, or to double check a downed website you are trying to access.

One of a set of tools we are providing to everyone as a way of saying thank you for being a part of the community.

Question has a verified solution.

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

Suggested Solutions

Title # Comments Views Activity
session migration servlets 2 42
more than one jdk and one jre 1 50
Oracle SQL syntax check  without executing 6 74
mysql jsp example issue 32 48
By the end of 1980s, object oriented programming using languages like C++, Simula69 and ObjectPascal gained momentum. It looked like programmers finally found the perfect language. C++ successfully combined the object oriented principles of Simula w…
Java had always been an easily readable and understandable language.  Some relatively recent changes in the language seem to be changing this pretty fast, and anyone that had not seen any Java code for the last 5 years will possibly have issues unde…
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 …
Viewers will learn how to properly install Eclipse with the necessary JDK, and will take a look at an introductory Java program. Download Eclipse installation zip file: Extract files from zip file: Download and install JDK 8: Open Eclipse and …

808 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