Colors of lines in line chart

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

Colors of lines in line chart

Post by northstar » Tue Sep 04, 2001 9:33 am

Hi,

I am using jfreechart to plot line charts. I realise that if I was ploting 2 lines that have identical values (for e.g, line 1 of red color and line 2 of blue color), the two lines seems to merge to form purple color on the chart. Is there any way to aviod this? For example, only one of the color is shown?

Thanks a lot...

northstar

David Gilbert

RE: Colors of lines in line chart

Post by David Gilbert » Mon Sep 17, 2001 2:57 pm

Hi,

I use the book "Java 2D Graphics" by Jonathan Knudsen. In the section on Compositing, it talks about the different compositing rules that you can use. In JFreeChart, I didn't even think about this, just used the default (which I think is AlphaComposite.SrcOver). Anyway, you should try adding a line of code in the draw method of the plot you are using:

g2.setComposite(AlphaComposite.Src);

I haven't tried it myself though...

Regards,

DG.

Locked