Page 1 of 1
The Colors property
Posted: Wed Apr 18, 2007 9:51 pm
by 9643227
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
Posted: Thu Apr 19, 2007 9:59 am
by 9348258
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());
}
Posted: Fri Apr 20, 2007 4:58 pm
by 9643227
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);
}
Posted: Mon Apr 23, 2007 8:49 am
by 9348258
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!
Posted: Mon Apr 23, 2007 4:57 pm
by 9643227
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.
Posted: Thu Apr 26, 2007 9:02 pm
by 9643227
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.
Posted: Fri Apr 27, 2007 3:14 pm
by 9348258
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));
}
Posted: Fri Apr 27, 2007 4:42 pm
by 9643227
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
Posted: Mon Apr 30, 2007 8:28 am
by 9348258
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);
Posted: Tue Jul 17, 2007 9:27 am
by 9348258
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.
Posted: Wed Jul 18, 2007 9:36 am
by 9348258
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.