- Home
- Forum
- ASP.NET Web Forms (Classic)
- Custom Color setting
Custom Color setting
Is there any way to change the pie segments colors so that they are a solid block of color without the light effect on it. I've
I quite like the effect but the end customer has asked whether the control can do it in this format as well.
Thanks.
example23.zip
I quite like the effect but the end customer has asked whether the control can do it in this format as well.
Thanks.
example23.zip
SIGN IN To post a reply.
3 Replies
AD
Administrator
Syncfusion Team
March 15, 2007 06:34 PM UTC
Hi Anon,
Thank you for using Syncfusion products.
You can set the pie segments colors without Gradient effect. I have changed pie segments colors in PrepareStyle event. Please refer to the following code snippet.
[ C# ]
void series1_PrepareStyle(object sender, ChartPrepareStyleInfoEventArgs args)
{
ChartSeries series = sender as ChartSeries;
if (series != null)
{
if (args.Index == 0)
args.Style.Interior = new BrushInfo(Color.Blue);
else if (args.Index == 1)
args.Style.Interior = new BrushInfo(Color.Aquamarine);
}
}
Please have a look at this sample and let me know if this helps you.
http://websamples.syncfusion.com/samples/Chart.Windows/F57982/main.htm
Regards,
Rajesh
Thank you for using Syncfusion products.
You can set the pie segments colors without Gradient effect. I have changed pie segments colors in PrepareStyle event. Please refer to the following code snippet.
[ C# ]
void series1_PrepareStyle(object sender, ChartPrepareStyleInfoEventArgs args)
{
ChartSeries series = sender as ChartSeries;
if (series != null)
{
if (args.Index == 0)
args.Style.Interior = new BrushInfo(Color.Blue);
else if (args.Index == 1)
args.Style.Interior = new BrushInfo(Color.Aquamarine);
}
}
Please have a look at this sample and let me know if this helps you.
http://websamples.syncfusion.com/samples/Chart.Windows/F57982/main.htm
Regards,
Rajesh
BS
Bruce Smith
March 20, 2007 10:06 AM UTC
Thanks for that. It was what I was after.
As a result I have another question. If for the pie chart OptomizePiePointPostions is set to true then the control decides on the positioning of the segment. Is there any way to get this order through the prepare style event. I can get the index of the data item but that does not give me the relative order it is shown in the pie chart. The reason why I ask is this is needed for setting the custom color for the segment to ensure the colors next to it do not clash.
As a result I have another question. If for the pie chart OptomizePiePointPostions is set to true then the control decides on the positioning of the segment. Is there any way to get this order through the prepare style event. I can get the index of the data item but that does not give me the relative order it is shown in the pie chart. The reason why I ask is this is needed for setting the custom color for the segment to ensure the colors next to it do not clash.
RR
Ramya R
Syncfusion Team
March 21, 2007 06:33 AM UTC
Hi Anon,
Thank You for the update.
If your intention is to make sure that the Colors of a segment do not match with nearby segments then it can be done by checking the index values of each segment and setting colors as in the previous update. Kindly take a look at the code snippets below,
private void series1_PrepareStyle(object sender, ChartPrepareStyleInfoEventArgs args)
{
ChartSeries series = sender as ChartSeries;
if (series != null)
{
if (args.Index == 0)
args.Style.Interior = new BrushInfo(Color.Blue);
else if (args.Index == 1)
args.Style.Interior = new BrushInfo(Color.Aquamarine);
}
}
(or)
private void series1_PrepareStyle(object sender, ChartPrepareStyleInfoEventArgs args)
{
ChartSeries series = sender as ChartSeries;
if (series != null)
{
if (args.Index == this.ChartWebControl1.Series[0].Points.IndexOf(this.ChartWebControl1.Series[0].Points[0]))
args.Style.Interior = new BrushInfo(Color.Blue
else if (args.Index == this.ChartWebControl1.Series[0].Points.IndexOf(this.ChartWebControl1.Series[0].Points[1]))
args.Style.Interior = new BrushInfo(Color.Aquamarine);
}
}
Let me know if I am wrong in getting your requirement.
Thanks & Regards,
Ramya.
Thank You for the update.
If your intention is to make sure that the Colors of a segment do not match with nearby segments then it can be done by checking the index values of each segment and setting colors as in the previous update. Kindly take a look at the code snippets below,
private void series1_PrepareStyle(object sender, ChartPrepareStyleInfoEventArgs args)
{
ChartSeries series = sender as ChartSeries;
if (series != null)
{
if (args.Index == 0)
args.Style.Interior = new BrushInfo(Color.Blue);
else if (args.Index == 1)
args.Style.Interior = new BrushInfo(Color.Aquamarine);
}
}
(or)
private void series1_PrepareStyle(object sender, ChartPrepareStyleInfoEventArgs args)
{
ChartSeries series = sender as ChartSeries;
if (series != null)
{
if (args.Index == this.ChartWebControl1.Series[0].Points.IndexOf(this.ChartWebControl1.Series[0].Points[0]))
args.Style.Interior = new BrushInfo(Color.Blue
else if (args.Index == this.ChartWebControl1.Series[0].Points.IndexOf(this.ChartWebControl1.Series[0].Points[1]))
args.Style.Interior = new BrushInfo(Color.Aquamarine);
}
}
Let me know if I am wrong in getting your requirement.
Thanks & Regards,
Ramya.
SIGN IN To post a reply.
- 3 Replies
- 3 Participants
-
BS Bruce Smith
- Mar 15, 2007 10:40 AM UTC
- Mar 21, 2007 06:33 AM UTC