Change Line and Label color of Pie Chart series

Hello,

How can i change Line , Label color of Pie Chart series, and add Custom Label for each series, I want to create chart like this  : 



Please see attached is the code that i use and it got me like this :



Attachment: DrawSfChart_ed5b16f6.zip

11 Replies

YP Yuvaraj Palanisamy Syncfusion Team July 8, 2021 12:26 PM UTC

Hi Ryan, 
 
Greetings from Syncfusion. 
 
You can achieve your requirement “Label text color, line color and added custom Label” with the help of TextColor, BorderColor and Text property of ChartSeries. Please find the code example below. 
 
CodeSnippet: 
sfChart.Series[0].Style.TextColor = Color.RosyBrown; 
sfChart.Series[0].Style.Border.Color = Color.RosyBrown; 
dataSeriesModel.XName = "Name"; 
dataSeriesModel.YNames = new string[] { "Value" }; 
 
series.SeriesModel = dataSeriesModel; 
 
//sfChart.PrimaryXAxis.LabelsImpl = dataLabelsModel; 
//sfChart.Series[0].ConfigItems.PieItem.ShowDataBindLabels = true; 
  
//           sfChart.Series[0].Styles[0].Interior = new Syncfusion.Drawing.BrushInfo(Syncfusion.Drawing.PatternStyle.None, System.Drawing.Color.Red, System.Drawing.Color.Yellow); 
  
//           sfChart.Series[0].Styles[1].Interior = new Syncfusion.Drawing.BrushInfo(Syncfusion.Drawing.PatternStyle.None, System.Drawing.Color.Blue, System.Drawing.Color.Green); 
 
var customColors = new List<Color> { Color.RosyBrown, Color.SaddleBrown, Color.RosyBrown, Color.SandyBrown }; 
 
for (int i = 0; i < series.Points.Count; i++) 
{ 
              sfChart.Series[0].Styles[i].Text = String.Format("{0} | {1}", lData[i].Year, lData[i].Sales); 
              sfChart.Series[0].Styles[i].Interior = new Syncfusion.Drawing.BrushInfo(customColors[i]); 
} 
 
 
Output: 
 
 
Regards, 
Yuvaraj. 



RY Ryan replied to Yuvaraj Palanisamy July 12, 2021 04:44 AM UTC

Hello, thanks for your reply.

Now i have 1 proble, how can i "ExplodeAll" without disrupting the Perfect Circle of the Pie Chart.

Because whenever i set ExplodeAll = true, the perfect circle was disrupted. i want to add spaces between Series Points 




YP Yuvaraj Palanisamy Syncfusion Team July 13, 2021 12:37 PM UTC

Hi Ryan, 
 
Currently we are validating this reported problem “When ExplodeAll, distrupting the circle of pie chart” and we will update you with complete details on or before 15th July 2021. We appreciate your patience until then. 
 
Regards, 
Yuvaraj.


RY Ryan July 14, 2021 05:17 AM UTC

Hello thanks for your reply.

I just want to add Spaces between Doughnut Chart Point Series. I found ExplodeAll method from the Demo, so i use it. But when i use ExplodeAll it's disrupting the Perfect Circle of the chart. 

Perhaps there's another method to add Spaces between Doughnut Chart Point Series ?

Awaiting your further news regarding this info.



YP Yuvaraj Palanisamy Syncfusion Team July 15, 2021 09:50 AM UTC

Hi Ryan, 
 
Thanks for your patience. 
 
We would like to suggest that maintain the space between the doughnut segment has been achieved with the help of setting Border width and Color property of Style in ChartSeries. Please refer the below code example.   
 
CodeSnippet: 
this.chartControl1.Series[0].ExplodedAll = true; 
  this.chartControl1.Series[0].ConfigItems.PieItem.LabelStyle = Syncfusion.Windows.Forms.Chart.ChartAccumulationLabelStyle.OutsideInColumn; 
 
this.chartControl1.Series[0].Style.Border.Color = Color.White; 
this.chartControl1.Series[0].Style.Border.Width = 10; 
 
Output: 
 
 
Please let us know if you have any concern. 
 
Regards, 
Yuvaraj. 



RY Ryan replied to Yuvaraj Palanisamy July 16, 2021 02:50 AM UTC

Hello, i tried to set the Border Color and Width, but the Line won't show if i set the Border color to white.
I want to add spaces between points with Label Line Connector visible like this :


How can i achieve this ?

Thanks and Regards



YP Yuvaraj Palanisamy Syncfusion Team July 20, 2021 02:55 AM UTC

Hi Ryan, 

Currently we are validating your query and we will update you with complete details on or before 22nd July 2021. We appreciate your patience until then. 

Regards, 
Yuvaraj.



YP Yuvaraj Palanisamy Syncfusion Team July 20, 2021 05:23 AM UTC

Hi Ryan, 
 
On further analysis, we have confirmed this “Pie segment radius rendered wrongly when enable the ExplodeAll” an issue. We will fix the issue reported issue and we will be included the fix in our weekly nuget release which will be scheduled to publish on 10th August 2021.  
 
You can now track the status of your request, review the proposed resolution timeline and contact us for any further inquiries through this link.      
    
      
Note: The provided feedback link is private, and you need to login to view this feedback   
  
Regards,  
Yuvaraj. 



YP Yuvaraj Palanisamy Syncfusion Team August 10, 2021 01:42 PM UTC

Hi Ryan,  
   
Sorry for the inconvenience.  
   
Due to we have planned to publish the Vol 2 SP1 release for this week, we didn’t publish the weekly nuget release today. Hence, we will include the fix in our upcoming weekly nuget release which is after the Vol2 SP1 release and we will be rolled out on 17th August 2021. Once we rolled out, we will let you know. 
 
Regards, 
Yuvaraj. 



YP Yuvaraj Palanisamy Syncfusion Team August 17, 2021 04:58 PM UTC

Hi Ryan, 
 
Sorry for the delay. 
 
Due to some technical hurdles, we are not including the fix in the today weekly nuget release, we will the fix the issue and included in our upcoming weekly nuget release which is scheduled to be roll out on 24th August 2021.  
 
Regards, 
Yuvaraj. 



GM Gayathri Manickam Syncfusion Team August 24, 2021 01:33 PM UTC

Hi Ryan, 
 
After discussing with the development team, we confirmed that segments are exploded based on the data points value, it doesn’t form a perfect circle while exploding. So, we consider this as a behavior. 
 
For reference, we have checked the excel pie and doughnut charts, segments are exploded based on the provided data points value. Please refer below excel charts. 
 
 
 
 
 
Please let us know if need any further assistance on this.  
 
Thanks, 
Gayathri M 


Loader.
Up arrow icon