Changing color between points in a series

TeeChart for Microsoft Visual Studio .NET, Xamarin Studio (Android, iOS & Forms) & Monodevelop.
Post Reply
Agrilink
Newbie
Newbie
Posts: 38
Joined: Thu Feb 02, 2006 12:00 am

Changing color between points in a series

Post by Agrilink » Tue Jun 06, 2006 3:21 am

Hi,

Is it possible to manually change the color between points AFTER adding a series?

I know you can do it when adding a series, however I want to set the color between each point in a line series after the series has been created, ie. loop through each series on the chart, and set the color between each point.

Is this possible?

Thanks in advance.

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

Post by Narcís » Tue Jun 06, 2006 11:26 am

Hi Agrilink,

Yes, you have 2 options to achieve that:

1. Using one of Add method overloads which allow a color for each series point.
2. Directly looping through all series points and accessing its ValueColor property:

Code: Select all

      for (int i = 0; i < tChart1.Series.Count; i++)
			{
        for (int j = 0; j < tChart1[j].Count; j++)
        {
          tChart1[i].ValueColor[j]=Color.FromArgb(i,j,0);
        }			 
			}
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

Agrilink
Newbie
Newbie
Posts: 38
Joined: Thu Feb 02, 2006 12:00 am

Post by Agrilink » Wed Jun 07, 2006 12:27 am

Regarding option 2, according to the help ValueColor is a method requiring a point index and returns the color, not a property?

The code provided throws a compile error.

Thanks.

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

Post by Narcís » Wed Jun 07, 2006 8:16 am

Hi Agrilink,

Yes, sorry, you should use:

Code: Select all

          tChart1[i].Colors[j] = Color.FromArgb(r, g, b);
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

Agrilink
Newbie
Newbie
Posts: 38
Joined: Thu Feb 02, 2006 12:00 am

Post by Agrilink » Wed Jun 07, 2006 11:43 pm

Excellent. Thanks Narcis.

Post Reply