ByteScout Spreadsheet SDK - C# - Add Surface Chart - ByteScout

ByteScout Spreadsheet SDK – C# – Add Surface Chart

  • Home
  • /
  • Articles
  • /
  • ByteScout Spreadsheet SDK – C# – Add Surface Chart

How to add surface chart in C# with ByteScout Spreadsheet SDK

The tutorial below will demonstrate how to add surface chart in C#

Source code documentation samples provide quick and easy way to add a required functionality into your application. ByteScout Spreadsheet SDK is the SDK that can write and read, modify and calculate Excel and CSV spreadsheets. Most popular formulas are supported. You may import or export data to and from CSV, XML, JSON as well as to and from databases, arrays. It can be used to add surface chart using C#.

C# code samples for C# developers help to speed up coding of your application when using ByteScout Spreadsheet SDK. This C# sample code is all you need for your app. Just copy and paste the code, add references (if needs to) and you are all set! Test C# sample code examples whether they respond your needs and requirements for the project.

Download free trial version of ByteScout Spreadsheet SDK from our website with this and other source code samples for C#.

On-demand (REST Web API) version:
 Web API (on-demand version)

On-premise offline SDK for Windows:
 60 Day Free Trial (on-premise)

Program.cs
      
using System; using System.Diagnostics; using Bytescout.Spreadsheet; using Bytescout.Spreadsheet.Charts; namespace CSharp { class Program { static void Main(string[] args) { // Create new Spreadsheet object Spreadsheet spreadsheet = new Spreadsheet(); spreadsheet.RegistrationName = "demo"; spreadsheet.RegistrationKey = "demo"; // Add new worksheet Worksheet sheet = spreadsheet.Workbook.Worksheets.Add("Sample"); // Add a data for Surface chart int count = 10; double step = 2 * Math.PI / (count - 1); for (int i = 0; i < count; i++) for (int j = 0; j < count; j++) sheet[i, j].Value = Math.Sin(step * Math.Sqrt(i * i + j * j)); // Add charts to worksheet Chart surfaceChart = sheet.Charts.AddChartAndFitInto(11, 1, 28, 8, ChartType.Surface); for (int i = 0; i < count; i++) surfaceChart.SeriesCollection.Add(new Series(sheet.Range(0, i, 9, i))); surfaceChart = sheet.Charts.AddChartAndFitInto(11, 10, 28, 17, ChartType.SurfaceWireframe); for (int i = 0; i < count; i++) surfaceChart.SeriesCollection.Add(new Series(sheet.Range(0, i, 9, i))); surfaceChart = sheet.Charts.AddChartAndFitInto(29, 1, 46, 8, ChartType.SurfaceTopView); for (int i = 0; i < count; i++) surfaceChart.SeriesCollection.Add(new Series(sheet.Range(0, i, 9, i))); surfaceChart = sheet.Charts.AddChartAndFitInto(29, 10, 46, 17, ChartType.SurfaceTopViewWireframe); for (int i = 0; i < count; i++) surfaceChart.SeriesCollection.Add(new Series(sheet.Range(0, i, 9, i))); // Save it as XLS spreadsheet.SaveAs("Output.xls"); // Close the document spreadsheet.Close(); // Open generated XLS file in default associated application Process.Start("Output.xls"); } } }

ON-PREMISE OFFLINE SDK

60 Day Free Trial or Visit ByteScout Spreadsheet SDK Home Page

Explore ByteScout Spreadsheet SDK Documentation

Explore Samples

Sign Up for ByteScout Spreadsheet SDK Online Training

ON-DEMAND REST WEB API

Get Your API Key

Explore Web API Docs

Explore Web API Samples

VIDEO

ON-PREMISE OFFLINE SDK

60 Day Free Trial or Visit ByteScout Spreadsheet SDK Home Page

Explore ByteScout Spreadsheet SDK Documentation

Explore Samples

Sign Up for ByteScout Spreadsheet SDK Online Training

ON-DEMAND REST WEB API

Get Your API Key

Explore Web API Docs

Explore Web API Samples

Tutorials:

prev
next