Chart Legend Is Populated with Labels of Categories

Hi,
I have a problem with chart creation.
When I create a chart with single serie (Embedded excel with 2 columns: 1 for categories and 1 for datapoints), the legend is populated with categories labels.

This is the embeded Excel (4.5 KB) created using the Aspose methods.
This is the chart (13.6 KB) in PPT file.

If I open the PPT, I select the chart and I click on “Reset to Match Style”, the chart becomes correct.

Another similar problem happens with colors on legend (15.9 KB).

@ValerioBordin,
Thank you for contacting support.

Please test the problem with the chart using the latest version of Aspose.Slides if it is possible. If the issue persists, please share the following data:

  • code example you used to create the chart
  • input and output files
  • Aspose.Slides version you used

You can zip the input and output files and upload them here.

Hi Andrey,
I’m using the last version of Aspose.Slides. I download it about 3 or 4 days ago (22.2.0.0).

This is the code to populate the categories

#region Categories
for (int i = 0; i < dataTable.Rows.Count; i++)
{
	Aspose.Slides.Charts.IChartDataCell chartDataCell = fact.GetCell(defaultWorksheetIndex, i + 1, 0, dataTable.Rows[i][0]);
	chart.ChartData.Categories.Add(chartDataCell);
}
#endregion

and this is the code to populate datacells

for (int i = 1; i < dataTable.Columns.Count; i++)
{
Aspose.Slides.Charts.IChartDataCell chartDataCell = fact.GetCell(defaultWorksheetIndex, 0, i, dataTable.Columns[i].ColumnName);
Aspose.Slides.Charts.IChartSeries serie = chart.ChartData.Series.Add(chartDataCell, Aspose.Slides.Charts.ChartType.Line)
serie.Format.Fill.FillType = Aspose.Slides.FillType.Solid;
serie.Format.Line.FillFormat.FillType = Aspose.Slides.FillType.Solid;
serie.Labels.DefaultDataLabelFormat.ShowValue = true;

for (int j = 0; j < dataTable.Rows.Count; j++)
{
chartDataCell = fact.GetCell(defaultWorksheetIndex, j + 1, i, dataTable.Rows[j][i]);
Aspose.Slides.Charts.IChartDataPoint dataPoint = serie.DataPoints.AddDataPointForLineSeries(chartDataCell);
dataPoint.Format.Fill.FillType = Aspose.Slides.FillType.Solid;
dataPoint.Format.Fill.SolidFillColor.Color = serie.Format.Line.FillFormat.SolidFillColor.Color;
}
}

@ValerioBordin,
Unfortunately, I cannot use your code examples to test the problem you described. Please share the comprehensive code example or simple standalone project and your output presentation file with the chart.