Error: Please add at least one series of data to the design chart

Hi, I have a spreadsheet with a couple of pivottables and charts. Through my code I fill the sheet which is the source of all the pivottables.

When calling excel.Save or excel.SaveToStream I get the following error:

Please add at least one series of data to the design chart.

This used to work in a pevious version of the file. The thing that I changed was a little vba script. Disabling this does not make a difference.

What could be the source of this exception?

Do you change the charts in your designer file at run time? And which version are you using now?

Please send your file and sample code to excel@aspose.com. I will check it ASAP.

I do not change the charts. I add data to one of the sheets, on which the pivottables are depending, which in turn are the source of the charts.

I’ve mailed you the xls file.

Hi, I’ve created a workaround.

I made sure that in my designerfile the pivots have some dummy data, and so the charts will all be filled with dummy data also. This fixed the exception.

BTW, is it possible to make the pivots and charts recalculate from the API?

regards, Felix

@fplanjer,
Aspose.Excel is discontinued now and no more under active development. It is replaced by another advanced product known as Aspose.Cells. There are lot of advanced features that are supported by Aspose.Cells available in different versions of MS Excel. You can create charts by adding series of data to a chart as demonstrated by the following sample code:

// For complete examples and data files, please go to https://github.com/aspose-cells/Aspose.Cells-for-.NET

// Instantiating a Workbook object
Workbook workbook = new Workbook();

// Adding a new worksheet to the Excel object
int sheetIndex = workbook.Worksheets.Add();

// Obtaining the reference of the newly added worksheet by passing its sheet index
Worksheet worksheet = workbook.Worksheets[sheetIndex];

// Adding sample values to cells
worksheet.Cells["A1"].PutValue(50);
worksheet.Cells["A2"].PutValue(100);
worksheet.Cells["A3"].PutValue(150);
worksheet.Cells["B1"].PutValue(4);
worksheet.Cells["B2"].PutValue(20);
worksheet.Cells["B3"].PutValue(50);

// Adding a chart to the worksheet
int chartIndex = worksheet.Charts.Add(Aspose.Cells.Charts.ChartType.Pyramid, 5, 0, 15, 5);

// Accessing the instance of the newly added chart
Aspose.Cells.Charts.Chart chart = worksheet.Charts[chartIndex];

// Adding SeriesCollection (chart data source) to the chart ranging from "A1" cell to "B3"
chart.NSeries.Add("A1:B3", true);

// Saving the Excel file
workbook.Save(dataDir + "output.xls");

Here is a document that can be referred to for more information on charts:
Creating and Customizing Charts

Download the latest free trial version here:
Aspose.Cells for .NET (Latest Version)

A runnable complete solution can be downloaded here to check exciting features of this new product without writing any code.