Go Premium for a chance to win a PS4. Enter to Win

x
  • Status: Solved
  • Priority: Medium
  • Security: Public
  • Views: 1452
  • Last Modified:

JFreeChart: Fill in XYPlot

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
allelopath
Asked:
allelopath
2 Solutions
 
mrcoffee365Commented:
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
 
for_yanCommented:
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
 
allelopathAuthor Commented:
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.

 
for_yanCommented:
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
 
objectsCommented:
0
 
allelopathAuthor Commented:
I haven't had time to work on this. I will close the question and post again if need be.
0

Featured Post

VIDEO: THE CONCERTO CLOUD FOR HEALTHCARE

Modern healthcare requires a modern cloud. View this brief video to understand how the Concerto Cloud for Healthcare can help your organization.

Tackle projects and never again get stuck behind a technical roadblock.
Join Now