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

Free Support Forum - aspose.com

Setting Chart Data of an existing series using data values

In my application I am using an excel template which has an empty chart and empty series defined in it. In my application I getting 2 strings

-Values = {2002,2003,2004,2005}
-Data = {54,89,34,45}
Here Values are the X axis and Data is the Y axis. I need to add these values to the chart. I need help with setting the data for the chart.

Hi Shubham,


Thank you for contacting Aspose support.

It would be appropriate that you should share your input spreadsheet containing the blank chart along with the desired results that you may create manually in Excel application. This will help us to understand your exact requirements and we will be in a better position to assist you. Moreover, please state your platform of interest (.NET/Java).

Hi again,


Please check the attached sanple spreadsheet containing a blank chart along with following piece of .NET (C#) code to fill the chart with constant values as per your original post.

C#

Workbook workbook = new Workbook(Path.Combine(dir, “template.xlsx”));
Worksheet worksheet = workbook.Worksheets[0];
Chart chart = worksheet.Charts[0];
chart.NSeries.Clear();

string data = “{54,89,34,45}”;
chart.NSeries.Add(data, false);

string category = “{2002,2003,2004,2005}”;
chart.NSeries.CategoryData = category;

workbook.Save(Path.Combine(dir, “output.xlsx”));

Please let me know if I have understood your question correctly and/or you need the sample code in any other language.

How could I write data on multiple categories?
Like
Q1 Q2 Q3 Q4 _____ Q1 Q2 Q3 Q4
____2015____________2016

@Mihai_Bratulescu,

Thanks for your query.

Could you please explain the issue in more detail? Provide us your sample code, template file (if any), output file generated by the latest version Aspose.Cells for .NET 19.1.x and expected output created by Excel for our reference. We will look into it and provide our feedback after analysis.