Table of Contents

Method Add

Namespace
DocWright.Spreadsheet
Assembly
DocWright.Spreadsheet.dll

Add(XlsxChartType, XlsxCellRange, string, XlsxChartOptions?)

Makes a chart of a range of the sheet, as Excel makes one from a selection (Phase 211): the series from the range by Excel's rule (down its columns when it has more rows than columns; a first row of text the series' names, a first column of text their categories, both when the top-left cell is empty; a scatter's first column its x values), placed with its top-left corner at a cell. Its caches hold the cells' values now, so a viewer that does not calculate shows it.

public XlsxChart Add(XlsxChartType type, XlsxCellRange data, string cell, XlsxChartOptions? options = null)

Parameters

type XlsxChartType

The type: any but the stock, surface, combination and 2016 types, which are not made here.

data XlsxCellRange

The range the chart plots, on this sheet.

cell string

The cell its top-left corner is at, such as F2.

options XlsxChartOptions

How it is made; null for Excel's defaults.

Returns

XlsxChart

The new chart.

Exceptions

ArgumentNullException

cell is null.

ArgumentException

The type is not made here, the range gives no series, the cell is not a cell reference, or a size is negative.

InvalidOperationException

The sheet is not a worksheet.