Color background of items in a legend

TeeChart for Microsoft Visual Studio .NET, Xamarin Studio (Android, iOS & Forms) & Monodevelop.
Post Reply
Mike Jones
Advanced
Posts: 192
Joined: Thu Feb 01, 2007 12:00 am
Contact:

Color background of items in a legend

Post by Mike Jones » Wed Feb 06, 2008 10:31 pm

In a chart legend, I would like to change the background color of an item in the list based on some business logic.

For example. Lets say I have 3 series's showing in a chart legend. I would like to maybe change the background color to gray of the 3rd item in the Legend while leaving the other 2 alone.

1. Is there anyway to do this with the existing code?
2. If not, is there a simple source code change we could make to accomplish this? We own the source.
3. If #1 or #2 not possible, I have looked at the ChartListBox control. It does not appear to have this capability either.

Narcís
Site Admin
Site Admin
Posts: 14730
Joined: Mon Jun 09, 2003 4:00 am
Location: Banyoles, Catalonia
Contact:

Post by Narcís » Thu Feb 07, 2008 3:10 pm

Hi Mike,

Please find below the answers to your questions:

1. I can think of a way to do that using chart's legend at the moment.
2. I think it's probable. However we don't support source code customizations.
3. Yes, ChartListBox can do that using SelectedIndex or SetSelected, for example:

Code: Select all

			chartListBox1.SetSelected(0, false);
			
			chartListBox1.SetSelected(1, true);	
			//or
			//chartListBox1.SelectedIndex = 1;			
Best Regards,
Narcís Calvet / Development & Support
Steema Software
Avinguda Montilivi 33, 17003 Girona, Catalonia
Tel: 34 972 218 797
http://www.steema.com
Image Image Image Image Image Image
Instructions - How to post in this forum

Mike Jones
Advanced
Posts: 192
Joined: Thu Feb 01, 2007 12:00 am
Contact:

chartListBox1.SetSelected()

Post by Mike Jones » Thu Feb 07, 2008 3:31 pm

If I do

chartListBox1.SetSelected(1);

I would assume I could not select more than 1 item at a time. I failed to make that clear in my previous post.

Let's say I wanted both the 1st and last items to have a different background. I would like to be able to do something like:

chartListBox1.Items[0].BackGround = System.Drawing.Color.Gray;
chartListBox1.Items[2].BackGround = System.Drawing.Color.Gray;

Making both items background gray at the same time.

Do you have any advise on how I might be able to do that?
I would actually do this one time as the list box it loaded up. I would not need to change the background color after initially loads.

Narcís
Site Admin
Site Admin
Posts: 14730
Joined: Mon Jun 09, 2003 4:00 am
Location: Banyoles, Catalonia
Contact:

Post by Narcís » Thu Feb 07, 2008 3:37 pm

Hi Mike,

Yes, using ChartListBox you can select more than one item at a time, for example:

Code: Select all

         chartListBox1.SetSelected(0, true);         
         chartListBox1.SetSelected(1, true);   
         //or
         //chartListBox1.SelectedIndex = 0;
         //chartListBox1.SelectedIndex = 1;
Best Regards,
Narcís Calvet / Development & Support
Steema Software
Avinguda Montilivi 33, 17003 Girona, Catalonia
Tel: 34 972 218 797
http://www.steema.com
Image Image Image Image Image Image
Instructions - How to post in this forum

Post Reply