Spire.XLS is a professional Excel .NET library that can be used to any type of .NET( C#, VB.NET, ASP.NET, .NET Core) application and Java (J2SE and J2EE) application.

Mon Aug 09, 2021 2:43 am

Hello
I want select columns for excel chart
For example
DataRange is A1:D3 and A is axis B,C,D is another axis
and
I want chart which display only A and B,D column
Using chart's serires property I can display B,C,D column name.
Bus I don't know how to avoid C column

kurikabocya
 
Posts: 13
Joined: Mon Aug 09, 2021 2:21 am

Mon Aug 09, 2021 8:28 am

Hello,

Thanks for your inquiry.
Please refer to the following code to meet your needs.
Code: Select all
            Workbook workbook = new Workbook();
            workbook.LoadFromFile("test.xlsx");

            Worksheet worksheet = workbook.Worksheets[0];
            Chart chart = worksheet.Charts.Add();
            chart.DataRange = worksheet.Range["A1:D3"];
            chart.ChartType = ExcelChartType.ColumnClustered;
            chart.Series[0].Values = worksheet.Range["A1:A3"];
            chart.Series[1].Values = worksheet.Range["B1:B3"];
            chart.Series[2].Values = worksheet.Range["D1:D3"];

            workbook.SaveToFile("result.xlsx", ExcelVersion.Version2016);

If this cannot help you, please provide your input file and your desired output for further investigation. You can send them to us (support@e-iceblue.com) via email, thanks in advance.

Sincerely,
Brian
E-iceblue support team
User avatar

Brian.Li
 
Posts: 1241
Joined: Mon Oct 19, 2020 3:04 am

Tue Aug 31, 2021 10:41 am

Hello,

Greetings from E-iceblue!
Did the code we provided work for you? Any feedback will be greatly appreciated.

Sincerely,
Brian
E-iceblue support team
User avatar

Brian.Li
 
Posts: 1241
Joined: Mon Oct 19, 2020 3:04 am

Return to Spire.XLS