The Colors property

TeeChart for Microsoft Visual Studio .NET, Xamarin Studio (Android, iOS & Forms) & Monodevelop.
Post Reply
Jeff
Newbie
Newbie
Posts: 22
Joined: Thu Nov 30, 2006 12:00 am

The Colors property

Post by Jeff » Wed Apr 18, 2007 9:51 pm

I would like to change the colors of the points of a series (i.e. the colors of each slice of a Pie series). I tried to use the Colors property of the Series class to get and set the color for each series point. I found that the Colors property returns an empty collection unless I have set it first. How do I get the color of each series point for a Series after I set the ColorEach property to true? Thank you.

Jeff

Edu
Advanced
Posts: 206
Joined: Tue Dec 05, 2006 12:00 am
Location: Girona, Catalonia

Post by Edu » Thu Apr 19, 2007 9:59 am

Hi Jeff

You can use the ValueColor() method, as below code:

Code: Select all

for (int i=0;i <pie1.Count;i++)
            {
               listBox1.Items.Add(pie1.ValueColor(i).ToString());
            }
Best Regards,
Edu

Steema Support Central
http://support.steema.com/

Jeff
Newbie
Newbie
Posts: 22
Joined: Thu Nov 30, 2006 12:00 am

Post by Jeff » Fri Apr 20, 2007 4:58 pm

Thanks for the reply.

Another problem is that after I set the color value of an item of the Colors property and then save the chart, the new color is not saved to the file. How do I fix this problem? The following is my code.

Code: Select all

         private void tChart_ClickSeries(object sender, Series s, int valueIndex, MouseEventArgs e)
        {
            if (e == null || sender == null || s == null) return;

            if (e.Clicks == 1)
            {
                if (s.ColorEach && Control.ModifierKeys == Keys.Control && valueIndex >= 0 && valueIndex <= s.Count)
                {
                    ColorDialog colorDialog = new ColorDialog();
                    colorDialog.Color = s.ValueColor(valueIndex);
                    if (colorDialog.ShowDialog() == DialogResult.OK)
                    {
                        s.Colors[valueIndex] = colorDialog.Color;
                        s.Repaint();
                    }
                }
            }
            else ShowSeriesEditor(s);
        }

Edu
Advanced
Posts: 206
Joined: Tue Dec 05, 2006 12:00 am
Location: Girona, Catalonia

Post by Edu » Mon Apr 23, 2007 8:49 am

Hi Jeff

Here It's working fine using the last release (Build 2.0.2652.22325). Which TeeChart version are you using? Could you please try with the last version?
If the problem persist could you please send us a simple example project we can run "as-is" to reproduce the issue here?

You can post your files either at [url]news://www.steema.net/steema.public.attachments[/url] newsgroup or at our upload page

Thanks in advance!
Best Regards,
Edu

Steema Support Central
http://support.steema.com/

Jeff
Newbie
Newbie
Posts: 22
Joined: Thu Nov 30, 2006 12:00 am

Post by Jeff » Mon Apr 23, 2007 4:57 pm

I am using the source code (Build 2.0.2586.24038) of TeeChart. I will try to merge the new changes into our modified source. Thank you.

Jeff
Newbie
Newbie
Posts: 22
Joined: Thu Nov 30, 2006 12:00 am

Post by Jeff » Thu Apr 26, 2007 9:02 pm

I found another problem: after the Colors property of a bar is set, the Transparency property has no effect for that specific bar. How do I fix it?

Thank you.

Edu
Advanced
Posts: 206
Joined: Tue Dec 05, 2006 12:00 am
Location: Girona, Catalonia

Post by Edu » Fri Apr 27, 2007 3:14 pm

Hi Jeff

I could reproduce the issue here and this seems to be a bug. I've added it (TF02012193) to our defect list to be fixed for future releases.

In the meantime, a workaround can be set the colors with the wish transparency, for example:

Code: Select all

 private void Form1_Load(object sender, EventArgs e)
        {
            bar1.Add(3, Color.FromArgb(255, Color.AliceBlue)); //255 is total opaque
            bar1.Add(1, Color.FromArgb(70,Color.AntiqueWhite)); 
            bar1.Add(4, Color.FromArgb(0,Color.Aqua)); //0 is total Transparency
            bar1.Add(5, Color.FromArgb(100,Color.Aquamarine));
            bar1.Add(3, Color.FromArgb(200,Color.Azure));    
        }
Best Regards,
Edu

Steema Support Central
http://support.steema.com/

Jeff
Newbie
Newbie
Posts: 22
Joined: Thu Nov 30, 2006 12:00 am

Post by Jeff » Fri Apr 27, 2007 4:42 pm

If the bar is already there - which means that I do not want to use the Add() function, how do I set the Colors property for a bar with a Transparency value? Thank you.

Jeff

Edu
Advanced
Posts: 206
Joined: Tue Dec 05, 2006 12:00 am
Location: Girona, Catalonia

Post by Edu » Mon Apr 30, 2007 8:28 am

Hi Jeff

You can accede to each point and change the color, as below code:

Code: Select all

for (int i=0;i<bar1.Count;i++)
               bar1[i].Color = Color.FromArgb(200, Color.Tomato);
Best Regards,
Edu

Steema Support Central
http://support.steema.com/

Edu
Advanced
Posts: 206
Joined: Tue Dec 05, 2006 12:00 am
Location: Girona, Catalonia

Post by Edu » Tue Jul 17, 2007 9:27 am

Hi Jeff

This defect (TF02012193 "Transparency property") has now been fixed. The fix will be included into the next maintenance release, due out before the end of next week.
Best Regards,
Edu

Steema Support Central
http://support.steema.com/

Edu
Advanced
Posts: 206
Joined: Tue Dec 05, 2006 12:00 am
Location: Girona, Catalonia

Post by Edu » Wed Jul 18, 2007 9:36 am

Hi Jeff

I'm sorry, the correction is in the version 3 and it's about Transparency of Points3D Series. There will not be a maintenance release to version 2 available at the end of the week.
Best Regards,
Edu

Steema Support Central
http://support.steema.com/

Post Reply