fill area between two lines in a graph

A discussion forum for JFreeChart (a 2D chart library for the Java platform).
Locked
tjchong

fill area between two lines in a graph

Post by tjchong » Wed Oct 27, 2004 5:23 am

Does anybody know how to fill the area between two lines in a graphs?

enrico
Posts: 49
Joined: Thu Jul 22, 2004 7:13 pm
Location: Shaanxi, P.R.China

Post by enrico » Wed Oct 27, 2004 11:12 am

How about first construct the rectangle, then use java.awt.Graphics2D.fill(java.awt.Shape) ?

I don't know whether I have caught what you said, my poor English... :(


Regards,
enrico

tjchong

Post by tjchong » Thu Oct 28, 2004 9:40 am

Is there anyway to use XYAreaRender to fill between the lines?

tjchong

Post by tjchong » Fri Oct 29, 2004 10:13 am

Does anybody have any suggestion how to do it?
Somebody help. thanks

angel
Posts: 899
Joined: Thu Jan 15, 2004 12:07 am
Location: Germany - Palatinate

Post by angel » Fri Oct 29, 2004 1:10 pm

Is this what you want?
Image

tjchong

Post by tjchong » Fri Oct 29, 2004 1:56 pm

The problem with the graph above use only two series. I have 4 lines and i want to shade for instance between line1 and line2. I thought of using XYDifferenceRenderer but it only uses two series only.

tjchong

Post by tjchong » Fri Oct 29, 2004 2:12 pm

I would like to have something the image shown on the URL

[/img]http://img27.exs.cx/img27/7403/graph6.jpg[url][/url]

david.gilbert
JFreeChart Project Leader
Posts: 11734
Joined: Fri Mar 14, 2003 10:29 am
antibot: No, of course not.
Contact:

Post by david.gilbert » Fri Oct 29, 2004 5:22 pm

You'll need to use two datasets and two renderers. The first dataset and renderer take care of the ordinary lines, the second dataset and renderer (XYDifferenceRenderer) take care of the fill between the other two lines.
David Gilbert
JFreeChart Project Leader

:idea: Read my blog
:idea: Support JFree via the Github sponsorship program

tjchong

Post by tjchong » Fri Oct 29, 2004 5:38 pm

Thanks David. It is a great help. i solve the problem already. :D

Locked