Free Support Forum - aspose.com

Pie chart values displaying inside of the chat

Hi

I am using Aspose.Cells 5.3.1.0 version.
I am writing into a excel template where it having some pie charts as well.
Here the problem is value are showing inside the pie chart even though data label position is showing “Outside”.

How can it can be fixed??

Please find the attached screen shot for your reference


Thanks,
Nagamani

Hi,


I used latest version/fix v7.0.1.x, it works fine. Bot generated xls and xlsx files are fine tuned. Here is my sample code for your reference.

Aspose.Cells.Workbook workbook = new Aspose.Cells.Workbook();
Aspose.Cells.Worksheet sheet = workbook.Worksheets[0];
sheet.Name = “Data”;
Aspose.Cells.Cells cells = workbook.Worksheets[0].Cells;
workbook.ChangePalette(Color.Orange, 53);
workbook.ChangePalette(Color.LightBlue, 54);
workbook.ChangePalette(Color.LightCoral, 55);
workbook.ChangePalette(Color.Indigo, 52);
Color[] colors = workbook.Colors;
cells[“A1”].PutValue("Excelsior lasalle property fund LLC ");
cells[“A2”].PutValue("Excelsior lasalle property fund\n LLC property fund LLC ");
cells[“A3”].PutValue(“Germany”);
cells[“A4”].PutValue(“England”);
cells[“A5”].PutValue(“Sweden”);
cells[“B1”].PutValue(“Sale”);
cells[“B2”].PutValue(0.32);
cells[“B3”].PutValue(0.62);
cells[“B4”].PutValue(0.06);
cells[“B5”].PutValue(0.06);


int chartIndex = 0;
chartIndex = sheet.Charts.Add(Aspose.Cells.Charts.ChartType.Pie, 1, 3, 25, 12);
Aspose.Cells.Charts.Chart c = sheet.Charts[chartIndex];


c.Legend.Border.IsVisible = false;
c.Legend.AutoScaleFont = true;
c.Legend.AutoScaleFont = false;
c.Legend.TextFont.Name = “Arial”;
c.Legend.TextFont.Size = 7;

c.Legend.Position = Aspose.Cells.Charts.LegendPositionType.Right;

c.ChartArea.Background = Aspose.Cells.Charts.BackgroundMode.Transparent;
c.NSeries.Add(“Data!B2:B5”, true);
c.NSeries.CategoryData = “Data!A2:A5”;
Aspose.Cells.Charts.DataLabels datalabels;
for (int i = 0; i < c.NSeries.Count; i++)
{
datalabels = c.NSeries[i].DataLabels;
datalabels.ShowPercentage = true;
datalabels.NumberFormat = “0%”;
datalabels.ShowValue = true;
datalabels.Postion = Aspose.Cells.Charts.LabelPositionType.OutsideEnd;
datalabels.TextFont.Name = “Arial”;
datalabels.TextFont.Size = 7;

}

c.PlotArea.X = 0;
c.PlotArea.Y = 700;


workbook.Save(“e:\test2\out1.xls”);
workbook.Save(“e:\test2\out2.xlsx”);


If you still find any issue with v7.0.1.x, paste your sample code (with template file if you have) same as I pasted above, we will look into your issue soon.

Thank you.