Chart background based on theme.

A discussion forum for JFreeChart (a 2D chart library for the Java platform).
Locked
develop
Posts: 296
Joined: Wed Mar 23, 2005 10:01 pm

Chart background based on theme.

Post by develop » Thu Aug 09, 2007 5:31 pm

is there anyway to set the chart background color based on theme used in application and not hard coded to specific one. ?

Thanks

AlanH99
Posts: 18
Joined: Wed Apr 05, 2006 3:31 pm
Location: Edinburgh UK

Post by AlanH99 » Thu Aug 09, 2007 5:48 pm

The setBackground...() methods of JFreeChart and Plot classes perhaps??

RichardWest
Posts: 844
Joined: Fri Oct 13, 2006 9:29 pm
Location: Sunnyvale, CA

Re: Chart background based on theme.

Post by RichardWest » Thu Aug 09, 2007 6:03 pm

develop wrote:is there anyway to set the chart background color based on theme used in application and not hard coded to specific one. ?
Only if you have some means to ask the application what the appropriate theme color is. Once you have that, just set the background color of the plot(s) in the normal manner. I cannot think of any automatic way since the color the user application might want might not be what you expect.
Richard West
Design Engineer II
Advanced Micro Devices
Sunnyvale, CA

develop
Posts: 296
Joined: Wed Mar 23, 2005 10:01 pm

Post by develop » Thu Aug 09, 2007 6:35 pm

actually we have main two theme, one which is all light colors and one is with all dark color (day trading).

user can switch between those, and i was looking for some automatic way, if Jfreechart gets background color from theme.

Thanks for reply

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

Post by skunk » Thu Aug 09, 2007 7:28 pm

Assuming that your "theme" is related to the PLAF, did you try something like this yet?

Code: Select all

chart.setBackgroundPaint(UIManager.getColor("control"));

Locked