Changing existing Charts

Hello,

I’m evaluating aspose.excel, and it looks very good, but I miss an important functionality ; changing the datasource for existing charts. Something very important for us. In fact it isn’t really mentioned in the features, but I searched this forum, and somewhere is replied that you were working on this item, and it should me released in a few weeks (28/5/2003 ). So , I hoped it would work by now ?
If so, please let me know how I can realise this.

Thanks, Luc

Hi Luc,

Yes, it’s available now. Please try to use the following code to change datasource for an existing chart:

Charts charts = excel.Worksheets[0].DesignCharts;
charts[0].NSeries.Add(“a1:b4”, true);

@LucSimarch,
Aspose.Excel is discontinued and is replaced by an advanced version Aspose.Cells that supports all the lates features available in different versions of MS Excel. Using Aspose.Cells, we can access particular chart and add series. Following examples demonstrates this feature:

//Load the source Excel file 
Workbook wb = new Workbook("sampleSeries_ValuesFormatCode.xlsx");

//Access first worksheet
Worksheet worksheet = wb.Worksheets[0];

//Access first chart
Chart ch = worksheet.Charts[0];

//Add series using an array of values
ch.NSeries.Add("{10000, 20000, 30000, 40000}", true);

//Access the series and set its values format code
Series srs = ch.NSeries[0];
srs.ValuesFormatCode = "$#,##0";

//Save the output Excel file
wb.Save("outputSeries_ValuesFormatCode.xlsx");

116461_1.jpg (274.0 KB)

For more information about working with charts, follow the below link:
Set the values format code of chart series

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

Here is a runnable solution that can be used to test different features of this new product:
A runnable solution can be downloaded here to test different features of this product.