This project has moved and is read-only. For the latest updates, please go here.

Position a DataLabel

Apr 9, 2012 at 9:46 PM

Hello

I have a PieChart with DataLabels visible.    Is there a way to position the DataLabel?  It looks like Best Fit  is only used but I would like them to be on the outside.

Thanks,

RalphTrent

Apr 12, 2012 at 6:49 PM

Hi,

Try to something like this (on the series)...

ser.DataLabel.Position = eLabelPosition.OutEnd; 
Jan
Apr 12, 2012 at 6:59 PM
Thanks for the reply.

here is my code:

OfficeOpenXml.Drawing.Chart.ExcelPieChart chartPie = (OfficeOpenXml.Drawing.Chart.ExcelPieChart)productDetailsWorksheet.Drawings.AddChart(lstrTitle + " PIE", OfficeOpenXml.Drawing.Chart.eChartType.Pie);
chartPie.DataLabel.ShowPercent = true;
chartPie.DataLabel.ShowLeaderLines = true;
chartPie.Legend.Position = eChart.eLegendPosition.Bottom;
chartPie.ShowHiddenData = true;
chartPie.Title.Text = lstrTitle;
chartPie.SetSize(500, 400);
chartPie.SetPosition(chart.From.Row, 0, chart.To.Column+1, 10);
chartPie.Series.Add(lerbValue, lerbTitle);

I tried to do as you suggested:
chartPie.Series[0].(looking for DataLabel.Position here)..

but I do not see a DataLabel class . Did I interpret your suggestion incorrectly?
There is also no Position property on chartPie.DataLabel

Please let me know if I missed something.

Thanks
RalphTrent
Dec 4, 2012 at 10:43 AM

 

ExcelChartSerieDataLabel dl = myChartOrSeries.DataLabel;
dl.Position...