Hi,
Hi Sharanya,
Thanks for your posting and using Aspose.Cells.
I have created your expected chart using the following code with the latest version: Aspose.Cells
for .NET v8.1.1.3.
You can use this code and employ it in your project.
I have attached the source xls file used in this code, output xls file with your expected chart generated by this code and screenshot for your reference.
C#
//Create workbook object from source file
Workbook workbook = new Workbook(“source.xls”);
//Access the first worksheet
Worksheet worksheet = workbook.Worksheets[0];
//Chart should span in this range
CellArea area = CellArea.CreateCellArea(“B10”, “AA27”);
//Create BarStacked chart in the above range
int idx = worksheet.Charts.Add(ChartType.BarStacked, area.StartRow, area.StartColumn, area.EndRow, area.EndColumn);
Chart chart = worksheet.Charts[idx];
//Add Chart Series
chart.NSeries.Add(“=Expected!$A$1:$B$8”, true);
//Make the first series invisible
chart.NSeries[0].Area.Formatting = FormattingType.None;
chart.NSeries[0].Border.IsVisible = false;
//Make the second series with custom color and make its border invisible
chart.NSeries[1].Area.Formatting = FormattingType.Custom;
chart.NSeries[1].Area.ForegroundColor = Color.FromArgb(192, 80, 77);
chart.NSeries[1].Border.IsVisible = false;
//Make the plot area white
chart.PlotArea.Area.Formatting = FormattingType.Custom;
chart.PlotArea.Area.ForegroundColor = Color.White;
//Delete the legend entries
chart.Legend.LegendEntries[0].IsDeleted = true;
chart.Legend.LegendEntries[1].IsDeleted = true;
//Set the font of the tick labels of category axis
chart.CategoryAxis.TickLabels.Font.Name = “Calibri”;
chart.CategoryAxis.TickLabels.Font.Size = 10;
//Set the font of the tick labels of value axis
chart.ValueAxis.TickLabels.Font.Name = “Calibri”;
chart.ValueAxis.TickLabels.Font.Size = 10;
//Save the workbook as output file
workbook.Save(“output.xls”);
The issues you have found earlier (filed as ) have been fixed in this update. This message was posted using BugNotificationTool from Downloads module by MuzammilKhan