Too Many Colors Exception...

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

Too Many Colors Exception...

Post by Raul Escobedo » Thu Apr 05, 2001 3:19 pm

I am trying to create a bar graph that will be displayed on a page as a gif image. The problem is that when the encoding is done I am getting an error that says "too many colors for a GIF." I am using the ACME the gifencoder. Is this a problem with the encoder or with jfreechart creating an image with too many colors. The graphs that I am creating do not contain more than 10 colors which is why I do not understand the exception. Has anyone seen this problem before? Thanks.

markus.frommherz

RE: Too Many Colors Exception...

Post by markus.frommherz » Thu Apr 05, 2001 4:40 pm

Hi Raul,
just a guess;
Do you use BackgroundPaint?
if so: use a fix Color like "Color.blue",
this will reduce the amount of used colors.

for test comment out
//chart.setChartBackgroundPaint(new GradientPaint(0, 0, Color.white, 0, 1000, Color.red));

Well, this is GIF-related limit. GIF s can 256 colors, no more.
try the JPEG-encoder delivered with JDK or think about PNG. I use JPEG.

greetings from cologne,

markus f.

Locked