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. Image for the cookie policy date

Pie chart legend repeating

I have done a pie chart in Excel using ExcelEngine and IChartShape. The legend of the pie chart is repeating.
Code:
            using (ExcelEngine excelEngine = new ExcelEngine())
            {
                IApplication application = excelEngine.Excel;
                application.DefaultVersion = ExcelVersion.Excel2013;
                IWorkbook workbook = application.Workbooks.Create(1);
                IWorksheet sheet = workbook.Worksheets[0];

                object[] yValues = new object[] { 2000, 1000, 1000 };
                object[] xValues = new object[] { "Total Income", "Expenses", "Profit" };

                //Adding series and values
                IChartShape chart = sheet.Charts.Add();
                //chart.Legend.IsVerticalLegend = false;
                //chart.Legend.Position = ExcelLegendPosition.Bottom;
                chart.HasLegend = false;
                IChartSerie serie = chart.Series.Add(ExcelChartType.Pie);

                //Enters the X and Y values directly
                serie.EnteredDirectlyValues = yValues;
                //serie.EnteredDirectlyCategoryLabels = xValues;

                application.DefaultVersion = ExcelVersion.Excel2013;
                application.XlsIORenderer = new XlsIORenderer();

                application.XlsIORenderer.ChartRenderingOptions.ImageFormat = ExportImageFormat.Png;
                MemoryStream stream = new MemoryStream();

                //Saving the chart as image
                chart.SaveAsImage(stream);

                stream.Position = 0;

                //Download the PDF document in the browser
                FileStreamResult fileStreamResult = new FileStreamResult(stream, "image/png");

                fileStreamResult.FileDownloadName = "Sample.png";

                return fileStreamResult;

            }


Attachment: New_folder_c0711df7.zip

5 Replies

KK Konduru Keerthi Konduru Ravichandra Raju Syncfusion Team December 16, 2019 10:25 AM UTC

Hi Fathimath, 

Greetings from Syncfusion. 

We are unable to reproduce the reported Pie chart legend repeating issue. The sample which we have tried at our end with the code snippet shared by you, can be downloaded from the following link. 


Please look into the following video screenshot for further reference. 


Kindly modify the sample and share us the issue reproducing one which will be helpful for us to investigate further and provide prompt solution at the earliest. Also, please confirm the version of Syncfusion XlsIO you are using. 

Regards, 
Keerthi. 



FN Fathimath Nazma Rasheed December 17, 2019 04:17 AM UTC

hello,

I was using version 17.3.0.34.
Issue is fixed after changing version to 17.3.0.26


KK Konduru Keerthi Konduru Ravichandra Raju Syncfusion Team December 18, 2019 07:15 AM UTC

Hi Fathimath, 

Thanks for sharing the details. 

We are able to reproduce the reported Pie chart legend repeating issue in v17.3.0.34 and validating it currently. We will share the validation details on 20th December 2019. 

Regards, 
Keerthi. 



KK Konduru Keerthi Konduru Ravichandra Raju Syncfusion Team December 20, 2019 04:12 PM UTC

Hi Fathimath, 

Thanks for the patience. 

We have confirmed the issue Chart legend is rendered twice in Chart to Image conversion and logged a defect report. We will provide the fix for this issue on 3rd January 2020. 

Regards, 
Keerthi. 



KK Konduru Keerthi Konduru Ravichandra Raju Syncfusion Team January 3, 2020 03:09 PM UTC

Hi Fathimath, 

Thanks for your patience. 

We have fixed the issue Chart legend is rendered twice in Chart to Image conversion and generated custom assemblies in the version v17.3.0.34. The custom assemblies can be downloaded from following link. 


This fix will be included in our release version 17.4-SP1 which will be rolled out by end of January 2020.  

Regards,     
Keerthi. 


Loader.
Live Chat Icon For mobile
Up arrow icon