Dynamically editing chart colors

A discussion forum for JFreeChart (a 2D chart library for the Java platform).
Locked
jas511
Posts: 6
Joined: Tue Sep 01, 2009 7:02 pm
antibot: No, of course not.

Dynamically editing chart colors

Post by jas511 » Tue Apr 13, 2010 7:12 pm

I created a bar chart (and stacked bar chart) and I noticed the right click menu doesn't have an option for actually changing the bar colors. Is this possible to do?

thanks,
Jeff
Jeff Storey, Software Developer
http://jeffastorey.blogspot.com

gengar
Posts: 26
Joined: Thu Mar 18, 2010 12:28 am
antibot: No, of course not.

Re: Dynamically editing chart colors

Post by gengar » Tue Apr 13, 2010 7:22 pm

It should be possible.
First, try adding an additional MenuItem to the existing menu and add an ActionListener to this MenuItem.
Note: The current popup menu can be accessed with the getPopupMenu() in ChartPanel class.
Then, implement your method to change the colors.
Finally, call this new method in the actionperformed method of the ActionListener.

jas511
Posts: 6
Joined: Tue Sep 01, 2009 7:02 pm
antibot: No, of course not.

Re: Dynamically editing chart colors

Post by jas511 » Tue Apr 13, 2010 7:26 pm

Thanks. That was my plan, just wanted to check if that feature is already in JFreeChart somewhere so I didn't reimplement something that was already done.
Jeff Storey, Software Developer
http://jeffastorey.blogspot.com

Locked