I have the following code meant to to create a pie chart. There are 2 issues. The first is getting the legend displayed properly and the 2nd is that the chart does not display properly
IWorksheet sheet10 = workbook.Worksheets[9];
sheet10.Range["A1"].Text = "How do ideas/opportunites get shared within the company.";
sheet10.Range["A1"].CellStyle.Font.Bold = true;
sheet10.Range["A1"].CellStyle.Font.Size = 18;
RadioButtonAnswers rba = new RadioButtonAnswers();
rba.SurveyNumber = SurveyNumber;
rba.GroupNumber = 10;
IList<GetRadioAnswerOccurances_Result> IdeasRadio = rba.RadioAnswers();
sheet10.ImportData(IdeasRadio, 3, 1, true);
IChartShape chart10 = sheet10.Charts.Add();
chart10.ChartType = ExcelChartType.Pie;
chartplacement = "A3:B7";
chart10.DataRange = sheet10.Range[chartplacement];
chart10.Legend.Position = ExcelLegendPosition.Bottom;
chart10.Series[0].DataPoints.DefaultDataPoint.DataLabels.Size = 8;
chart10.TopRow = 3;
chart10.BottomRow = 25;
chart10.LeftColumn = 1;
chart10.RightColumn = 15;
I have tried as both A3:B7 and A4:B7 trying to get the legend correctly displayed
when finished it looks like what is shown in the excel file instead of what you see in the jpg image
note this is dynamic data and the only time the data will look like this is during this test otherwise it will be totally different and with totally different numbers so filling in data at design time is NOT an option.
Attachment:
pieChart_fa04053d.zip