Still celebrating National IT Professionals Day with 3 months of free Premium Membership. Use Code ITDAY17

x
?
Solved

JFreeChart: Fill in XYPlot

Posted on 2011-02-21
6
Medium Priority
?
1,417 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 1000 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
Concerto's Cloud Advisory Services

Want to avoid the missteps to gaining all the benefits of the cloud? Learn more about the different assessment options from our Cloud Advisory team.

 
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 1000 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

The top UI technologies you need to be aware of

An important part of the job as a front-end developer is to stay up to date and in contact with new tools, trends and workflows. That’s why you cannot miss this upcoming webinar to explore the latest trends in UI technologies!

Question has a verified solution.

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

An old method to applying the Singleton pattern in your Java code is to check if a static instance, defined in the same class that needs to be instantiated once and only once, is null and then create a new instance; otherwise, the pre-existing insta…
In this post we will learn different types of Android Layout and some basics of an Android App.
Viewers will learn about basic arrays, how to declare them, and how to use them. Introduction and definition: Declare an array and cover the syntax of declaring them: Initialize every index in the created array: Example/Features of a basic arr…
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 …
Suggested Courses

704 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