Table of Contents

Class ExcelChart

Namespace
SheetStream
Assembly
SheetStream.dll

A chart placed on a worksheet, referencing data already on a sheet. Create with AddChart(ChartType, string), then add series. The chart reads the cells when Excel opens the file.

public sealed class ExcelChart
Inheritance
ExcelChart
Inherited Members

Examples

var chart = sheet.AddChart(ChartType.Column, "E2:L20");
chart.Title = "Revenue by SKU";
chart.AddSeries(values: "C2:C11", categories: "B2:B11", name: "=C1");

Properties

DataLabels

Data labels on points. Default none.

public ChartDataLabels DataLabels { get; set; }

Property Value

ChartDataLabels

Legend

Legend placement. Default right.

public LegendPosition Legend { get; set; }

Property Value

LegendPosition

Series

The series added so far.

public IReadOnlyList<ChartSeries> Series { get; }

Property Value

IReadOnlyList<ChartSeries>

Title

Chart title, or null for none.

public string? Title { get; set; }

Property Value

string

Type

The chart kind.

public ChartType Type { get; }

Property Value

ChartType

ValueAxisNumberFormat

Number format of the value axis, e.g. "$#,##0". Null follows the source cells.

public string? ValueAxisNumberFormat { get; set; }

Property Value

string

XAxisTitle

Category (horizontal) axis title.

public string? XAxisTitle { get; set; }

Property Value

string

YAxisTitle

Value (vertical) axis title.

public string? YAxisTitle { get; set; }

Property Value

string

Methods

AddSeries(string, string?, string?, string?)

Adds a series. Ranges are A1 ranges on this sheet ("C2:C11") or sheet-qualified ("'Data'!C2:C11"). name is literal text, or a cell reference when it starts with "=" (e.g. "=C1").

public ChartSeries AddSeries(string values, string? categories = null, string? name = null, string? color = null)

Parameters

values string
categories string
name string
color string

Returns

ChartSeries