We use cookies to give you the best experience on our website. If you continue to browse, then you agree to our privacy policy and cookie policy. Image for the cookie policy date
close icon

Category Data Labels on Pie Chart

I''m trying to create a pie chart with labels for each section of the pie along with the associated value. And I would pefer that it not be in a lengend. With my code shown below I am not able to get it to show the category labels. My data has a label in column B and the value (percentage) in column C. Is there something that I am doing wrong? Any suggestions would be great. Thanks, Brian ---------------------------------------------- IChartShape chart = _CurrentWorksheet.Charts.Add(); chart.ChartType = ExcelChartType.Pie_3D; chart.Series.Add(); chart.Series[0].CategoryLabels = _CurrentWorksheet.Range["B22:B27"]; chart.Series[0].Values = _CurrentWorksheet.Range["C22:C27"]; chart.IsLegendVisible = false; chart.LabelsSeparator = " "; chart.IsLabelsCategory = true; chart.IsLabelsValue = true;

1 Reply

AD Administrator Syncfusion Team June 19, 2006 05:05 PM UTC

Hi Brian, Sorry for the delay in responding to you. Please use the following code for displaying values and labels in series. IChartDataPoint point = chart.Series[0].DataPoints.DefaultDataPoint; IChartDataLabels labels = point.DataLabels; //Setting labels in series. labels.IsCategoryName=true; //Setting value in series. labels.IsValue = true; Here is the sample for your reference:Chart_labels.zip Regarding setting labels in series, currently there are some issues in it. I will consult with the development team regarding this and send you an update as soon as possible. Please let me know if you have any other concerns. Thanks, Bharath.

Loader.
Live Chat Icon For mobile
Up arrow icon