Incorrect values when reading line chart from workbook

Hi,

When reading information about data series from a line chart embedded within a worksheet, Aspose.Cells.Charts.Series.DisplayName and Aspose.Cells.Charts.Series.Area.ForegroundColor are not correct.

For example, when the following code is used to read the attached workbook

static void Main(string[] args)
{
Workbook wkbk = new Workbook(@“test.xlsx”);

foreach (Worksheet wks in wkbk.Worksheets)
{
foreach (Chart chart in wks.Charts)
{
chart.Calculate();
chart.RefreshPivotData();

Console.WriteLine("Chart Name: " + chart.Name);

SeriesCollection dataSource = chart.NSeries;
foreach (Series series in dataSource)
{
Console.WriteLine("Series DisplayName: " + series.DisplayName);
Console.WriteLine("Series Name: " + series.Name);
Console.WriteLine("Series ForegroundColor: " + series.Area.ForegroundColor.ToString());
Console.WriteLine("Series Values: " + series.Values);
}
Console.WriteLine();
}
}
}

The resulting output is:

Chart Name: Line Chart
Series DisplayName: Two
Series Name: =Sheet1!$B$1
Series ForegroundColor: Color [A=0, R=155, G=187, B=89]
Series Values: =Sheet1!$B$2:$B$32
Series DisplayName: Three
Series Name: =Sheet1!$C$1
Series ForegroundColor: Color [A=0, R=128, G=100, B=162]
Series Values: =Sheet1!$C$2:$C$32
Series DisplayName:
Series Name: =Sheet1!$D$1
Series ForegroundColor: Color [Empty]
Series Values: =Sheet1!$D$2:$D$32

Chart Name: Bar Chart
Series DisplayName: Day
Series Name: =Sheet1!$A$1
Series ForegroundColor: Color [A=0, R=0, G=255, B=0]
Series Values: =Sheet1!$A$2:$A$32
Series DisplayName: One
Series Name: =Sheet1!$B$1
Series ForegroundColor: Color [A=0, R=255, G=0, B=0]
Series Values: =Sheet1!$B$2:$B$32

Chart Name: Column Chart
Series DisplayName: One
Series Name: =Sheet1!$B$1
Series ForegroundColor: Color [A=0, R=0, G=0, B=255]
Series Values: =Sheet1!$B$2:$B$32
Series DisplayName: Two
Series Name: =Sheet1!$C$1
Series ForegroundColor: Color [A=0, R=255, G=0, B=0]
Series Values: =Sheet1!$C$2:$C$32
Series DisplayName: Three
Series Name: =Sheet1!$D$1
Series ForegroundColor: Color [A=0, R=0, G=255, B=0]
Series Values: =Sheet1!$D$2:$D$32

The values highlighted in red do not seem to be correct when compared with what’s in the line chart in the workbook. In comparison, the corresponding values for the bar chart and the column chart look correct.

Can you please investigate? Thanks.


Hi Lawrence,

Thanks for your posting and using Aspose.Cells.

We were able to observe this issue after running your code with your source xlsx file using the latest version: Aspose.Cells
for .NET v8.1.2.1
. We got the same output as yours.

We have logged this issue in our database for investigation. We will look into it and fix this issue. Once, the issue is resolved or we have some other update for you, we will let you know asap.

This issue has been logged as CELLSNET-42872.

Hi,

Thanks for your using Aspose.Cells.

Please download and try the latest fix: Aspose.Cells for .NET v8.1.2.3.

If the type is line, please use Line.Color property.

Please see the following
code:

C#
foreach (Worksheet wks in
workbook.Worksheets)
{
foreach (Chart chart in
wks.Charts)
{

chart.Calculate();

chart.RefreshPivotData();

Console.WriteLine("Chart
Name: " + chart.Name);

SeriesCollection dataSource =
chart.NSeries;
foreach (Series series in
dataSource)
{

Console.WriteLine("Series DisplayName: " +
series.DisplayName);
Console.WriteLine("Series Name:
" + series.Name);
Console.WriteLine("Series border
ForegroundColor: " + series.Border.Color.ToString());

Console.WriteLine("Series ForegroundColor: " +
series.Area.ForegroundColor.ToString());

Console.WriteLine("Series Values: " + series.Values);

}
Console.WriteLine();

}
}

Just confirming that the problem has been fixed.

Hi Lawrence,

Thanks for your feedback and using Aspose.Cells.

It is good to know that your issue is resolved with the latest version. Let us know if you encounter any other issue, we will be glad to look into your issue and help you further.

The issues you have found earlier (filed as CELLSNET-42872) have been fixed in this update.


This message was posted using Notification2Forum from Downloads module by Aspose Notifier.