EPPlus饼图可统计重叠问题

时间:2019-06-25 15:31:46

标签: c# epplus

Sample Image 在这里,我试图移动由EPPlus创建的饼图的数据标签的位置。目前,其重叠部分很少。

我有VS 2013和EPPlus 5.1.2版本。此问题是由于一块蛋糕上的数字较小而引起的。

   ExcelPieChart consumableChart = (ExcelPieChart)worksheet6.Drawings.AddChart("UncommittedPieChart", eChartType.Pie);
                            ExcelRange r5, r6;

                            r5 = worksheet3.Cells[String.Concat(startColumnUncommitted, startIndexUncommitted.ToString(), ":", startColumnUncommitted, Convert.ToInt32(endIndexUncommitted + 1))];
                            r6 = worksheet3.Cells[String.Concat(endColumnUncommitted, startIndexUncommitted.ToString(), ":", endColumnUncommitted, Convert.ToInt32(endIndexUncommitted + 1))];
                            //consumableChart.Series.Add(r6, r5);
                            var serie = consumableChart.Series.Add(r6, r5);
                            consumableChart.Style = OfficeOpenXml.Drawing.Chart.eChartStyle.Style2;
                            consumableChart.Title.Text = String.Concat("Funds Uncommitted by FA5 ", System.Environment.NewLine, "$ ", worksheet3.Cells[(totalUncomRow + 1), 13].Text);
                            consumableChart.Legend.Remove();
                            consumableChart.SetPosition(5, 5, 5, 5);
                            consumableChart.SetSize(1080, 1080);
                           // consumableChart.DataLabel.Position = eLabelPosition.BestFit;

                            var pieSerie = (ExcelPieChartSerie)serie;
                            pieSerie.DataLabel.ShowValue = true;
                            pieSerie.DataLabel.ShowLeaderLines = true;
                            pieSerie.DataLabel.ShowCategory = true;
                            pieSerie.DataLabel.ShowPercent = true;
                            pieSerie.DataLabel.ShowSeriesName = true;
                            pieSerie.DataLabel.Position = eLabelPosition.BestFit;

我希望通过使用此代码来使数据标签不重叠

pieSerie.DataLabel.Position = eLabelPosition.BestFit;

我该如何实现?

谢谢。

0 个答案:

没有答案