Too Many Colors Exception...
Too Many Colors Exception...
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.
RE: Too Many Colors Exception...
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.
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.