How to prevent colors getting mixed in XYAreaChart?

A discussion forum for JFreeChart (a 2D chart library for the Java platform).
Locked
Pavvi
Posts: 7
Joined: Thu Jul 20, 2006 11:45 am

How to prevent colors getting mixed in XYAreaChart?

Post by Pavvi » Thu Jul 20, 2006 11:54 am

Hi,

Can anyone please let me know the methods that can be used to prevent colors getting mixed in XYAreaChart?
Need help ASAP.

Thanks
Pavan.

Pavvi
Posts: 7
Joined: Thu Jul 20, 2006 11:45 am

The series colors get mixed to produce a new color.

Post by Pavvi » Thu Jul 20, 2006 4:27 pm

Guys,

Have any idea about this?
Let me put question in another way.

In an XYAreaChart, when area of any two series overlap, the corresponding colors get mixed resulting in a new color.
How to avoid this?
Please let me know if there any methods to dsiable this default behaviour.
Need help urgently.

Thanks in advance.
Pavan.

skunk
Posts: 1087
Joined: Thu Jun 02, 2005 10:14 pm
Location: Brisbane, Australia

Post by skunk » Thu Jul 20, 2006 4:39 pm

The colors being used are probably transparent. Try setting the alpha to 255

Pavvi
Posts: 7
Joined: Thu Jul 20, 2006 11:45 am

Post by Pavvi » Mon Jul 24, 2006 7:41 am

Hi,

Can you please be more specific as to how to set the alpha to 255?
And how would it help to resolve the issue?
I have tried changing the colors already.
Please let me know ASAP.

Thanks
Pavan.

purplerhino
Posts: 1
Joined: Thu Apr 28, 2005 10:23 pm
Location: Chicago IL

Post by purplerhino » Tue Jul 25, 2006 6:08 pm

here's how i turned off transparency

Code: Select all

			// Create the Chart
			chart = ChartFactory.createXYAreaChart(title,
									xAxisLabel,yAxisLabel,
									dataset,
									PlotOrientation.VERTICAL,
									true,  // legend
									false,  // tool tips
									false  // URLs
									);
			
			XYPlot plot = (XYPlot) chart.getPlot();
	        
			//set the color transparency
			plot.setForegroundAlpha(1f);

Pavvi
Posts: 7
Joined: Thu Jul 20, 2006 11:45 am

Post by Pavvi » Wed Jul 26, 2006 7:25 am

It worked :-)

Thanks a lot.

Locked