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. (Last updated on: November 16, 2018).
Unfortunately, activation email could not send to your email. Please try again.
Syncfusion Feedback

pie chart issue

Thread ID:





132108 Aug 14,2017 08:53 PM UTC Aug 16,2017 10:40 AM UTC ASP.NET MVC 3
Tags: XlsIO
Miranda Johnson
Asked On August 14, 2017 08:53 PM UTC

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

Sridhar Sukumar [Syncfusion]
Replied On August 15, 2017 09:54 AM UTC

Hi Miranda,  
Thank you for contacting Syncfusion support. 
You can achieve your requirement by setting Chart.IsSeriesInRows property as false. Please refer the following code example to achieve this. 
Code snippet: 
Chart.IsSeriesInRows = false; 
We have prepared a sample to achieve your requirement in XlsIO which can be downloaded from the following link. 
Sample link: 

Miranda Johnson
Replied On August 15, 2017 06:56 PM UTC

Thank you.  That worked great.  :)  


Sridhar Sukumar [Syncfusion]
Replied On August 16, 2017 10:40 AM UTC

Hi Miranda, 
We are glad that the issue is resolved at your end. Please let us know if you need any further assistance. 


This post will be permanently deleted. Are you sure you want to continue?

Sorry, An error occured while processing your request. Please try again later.

Please sign in to access our forum

or the page will be automatically redirected to sign-in page in 10 seconds.

Warning Icon You are using an outdated version of Internet Explorer that may not display all features of this and other websites. Upgrade to Internet Explorer 8 or newer for a better experience.Close Icon