Sample source code below will show you how to cope with a difficult task like add combination chart in C#. ByteScout Spreadsheet SDK is the SDK to create, read, modify and calculate spreadsheets. Formula calculations are supported, import and export to and from JSON, CSV, XML, databases, arrays. It can add combination chart in C#.
This code snippet below for ByteScout Spreadsheet SDK works best when you need to quickly add combination chart in your C# application. Follow the instructions from the scratch to work and copy the C# code. This basic programming language sample code for C# will do the whole work for you to add combination chart.
ByteScout free trial version is available for download from our website. It includes all these programming tutorials along with source code samples.
On-demand (REST Web API) version:
Web API (on-demand version)
On-premise offline SDK for Windows:
60 Day Free Trial (on-premise)
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 few random numbers
int length = 10;
Random rnd = new Random();
for (int i = 0; i < length; i++)
{
sheet.Cell(i, 0).Value = rnd.Next(10);
sheet.Cell(i, 1).Value = rnd.Next(10);
}
// Add charts to worksheet
Chart columnChart = sheet.Charts.AddChart(5, 4, ChartType.ColumnClustered);
columnChart.SeriesCollection.Add(new Series(sheet.Range(0, 0, 9, 0)));
Series series = new Series(sheet.Range(0, 1, 9, 1));
series.ChartType = ChartType.Line;
columnChart.SeriesCollection.Add(series);
// Save it as XLS
spreadsheet.SaveAs("Output.xls");
// Close the document
spreadsheet.Close();
// Cleanup
spreadsheet.Dispose();
// Open generated XLS file in default associated application
Process.Start("Output.xls");
}
}
}
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
Get Your API Key
Explore Web API Docs
Explore Web API Samples
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
Get Your API Key
Explore Web API Docs
Explore Web API Samples
also available as: