We use cookies to give you the best experience on our website. If you continue to browse, then you agree to our privacy policy and cookie policy. Image for the cookie policy date

How to set series value

Hi,

How to set chart series value in Excel file.
I am using following code.

ExcelEngine oengine = new ExcelEngine();
IApplication oApp = oengine.Excel;
oApp.DefaultVersion = ExcelVersion.Excel2007;
IWorkbook oWorkbook  =  oApp.Workbooks.Create(1);
IWorksheets osheets = oWorkbook.Worksheets;
IWorksheet  osheet = osheets .Worksheets[0];

IChart ochart = osheet.Charts.Add();
IChartSerie oserie = ochart.Series.Add();
oserie.value = "......";

Excel file is attach .This file have contain a chart with two series. In this chart how to set series range value.

Thanks
sharad kumar



Attachment: 6paretoanalysischartexceltemplate_d51c6039.rar

3 Replies

KD Kesavan D Syncfusion Team September 16, 2016 10:53 AM UTC

Hi Sharad, 

Thank you for contacting Syncfusion support. 

We can set chart series using XlsIO by using below code snippet. 

            IChart chart = sheet.Charts[0]; 
            IChartSerie series = chart.Series.Add(); 
            series.Name = "WP2"; 
            series.Values = sheet.Range["M3:M13"]; 

We have also prepared a sample to illustrate the above code snippet which can be downloaded from below link, 


Feel free to refer our documentation page, 


Kesavan 



SK Sharad Kumar September 16, 2016 11:12 AM UTC

Hi,

Thanks for your replay.

In this file , Two series present in chart.   
 1)         Series Name    ->    Series2
             Series value     ->     ='6pareto-analysis-chart-excel-template.xlsx'!fre
 2)         Series Name    ->    Series3
             Series value     ->     ='6pareto-analysis-chart-excel-template.xlsx'!cum

IChart chart = sheet.Charts[0]; 
IChartSerie series = chart.Series.Add(); 
 series.Name = "WP2"; 
series.Values = sheet.Range["='6pareto-analysis-chart-excel-template.xlsx'!fre"];       // XLSIO liberary throw exception

output file have two series without series value.
 


SS Sridhar Sukumar Syncfusion Team September 19, 2016 12:36 PM UTC

Hi Sharad,  
 
Thank you for updating us. 
 
We regret to let you know that currently we don’t have support to set external workbook range to a chart series. However, we have added it to our Feature request list and it will be implemented in any of our upcoming releases. 
 
Regards, 
Sridhar S 


Loader.
Live Chat Icon For mobile
Up arrow icon