background of the axis labels

A discussion forum for JFreeChart (a 2D chart library for the Java platform).
Locked
henk
Posts: 3
Joined: Tue Apr 03, 2007 8:14 am

background of the axis labels

Post by henk » Tue Apr 03, 2007 8:22 am

Hi,

I would like to have a colored background for my axis labels and I was wondering how I can achieve it with jfreechart.
Take for instance this image :
www(dot)meteo(dot)be/nederlands/gfx/Klimatologisch/nl60390.png
I would like to fill the the boxes surrounding the letter of the month with a certain color.
Maybe I can draw this myself using java2d, but then I need a transparant background for the chart. Is that possible ?
Any ideas how to solve this nicely ?

Thanks a lot

Henk

sorry for the link, but I'm not allowed to include it as a new user :(

TheBear
Posts: 21
Joined: Mon Feb 20, 2006 3:16 pm

Post by TheBear » Tue Apr 03, 2007 2:03 pm

Hi Henk,
I do not know if jfreechart supports colored label backgrounds. But according to the transparent background I would say that

Code: Select all

chart.setBackgroundPaint(new Color(0,0,0,0));
should do the job (Alpha value is zero, should be transparent).

Greetings

Björn

henk
Posts: 3
Joined: Tue Apr 03, 2007 8:14 am

Post by henk » Tue Apr 03, 2007 4:10 pm

Thanks, your suggestion worked.
I managed to use a transparent background and then used graphics2d to draw a colored rectangle below the domain axis.
I plotted the chart on top of the rectangle and got more or less what I wanted.

thanks

Henk

Locked