We're sorry Aspose doesn't work properply without JavaScript enabled.

Free Support Forum - aspose.com

Chart Series values in date format

Hi,


Attached is the zip file which has the input, output excel files and the project. The output chart from the project file is in the first sheet and the expected output is in the second sheet of the output excel file.

There are 2 charts generated for the 2 sets of data. Both the charts have issues.

The issues are -

1. Sometimes the chart starts from NULL date (00-Jan 1900), though the date is of correct format (As seen in the first chart)

2. The duration column data series is not shown as in the “Expected” sheet.(In both the charts)

Please suggest

Thanks,
Sharanya

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