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
Legend
Legend placement. Default right.
public LegendPosition Legend { get; set; }
Property Value
Series
The series added so far.
public IReadOnlyList<ChartSeries> Series { get; }
Property Value
Title
Chart title, or null for none.
public string? Title { get; set; }
Property Value
Type
The chart kind.
public ChartType Type { get; }
Property Value
ValueAxisNumberFormat
Number format of the value axis, e.g. "$#,##0". Null follows the source cells.
public string? ValueAxisNumberFormat { get; set; }
Property Value
XAxisTitle
Category (horizontal) axis title.
public string? XAxisTitle { get; set; }
Property Value
YAxisTitle
Value (vertical) axis title.
public string? YAxisTitle { get; set; }
Property Value
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)