Table of Contents

Class ChartDocument

Namespace
OdfKit.Chart
Assembly
OdfKit.dll

Represents a high-level ODF chart document. 表示高階 ODF 圖表文件(Chart Document)的類別。

public class ChartDocument : OdfChartDocument, IDisposable, IAsyncDisposable
Inheritance
ChartDocument
Implements
Derived
Inherited Members

Constructors

ChartDocument(OdfPackage)

Initializes a new instance of the ChartDocument class with the specified ODF package. 使用指定的 ODF 封裝初始化 ChartDocument 類別的新執行個體。

public ChartDocument(OdfPackage package)

Parameters

package OdfPackage

The ODF package instance. / ODF 封裝執行個體。

ChartDocument(OdfPackage, string)

Initializes a new instance of the ChartDocument class with the specified ODF package and sub-path. 使用指定的 ODF 封裝與子路徑初始化 ChartDocument 類別的新執行個體。

public ChartDocument(OdfPackage package, string subPath)

Parameters

package OdfPackage

The ODF package instance. / ODF 封裝執行個體。

subPath string

The sub-path within the package. / 封裝內的子路徑。

Methods

Builder()

Creates a fluent builder for a high-level chart document. 建立高階圖表文件 Fluent builder。

public static ChartDocumentBuilder Builder()

Returns

ChartDocumentBuilder

A new ChartDocumentBuilder instance. / 新的 ChartDocumentBuilder 執行個體。

Create(OdfChartDefinition)

Creates a new high-level chart document from a chart definition. 根據圖表定義建立新的高階圖表文件。

public static ChartDocument Create(OdfChartDefinition chartDefinition)

Parameters

chartDefinition OdfChartDefinition

The chart configuration and definition information. / 圖表設定與定義資訊。

Returns

ChartDocument

The created high-level ChartDocument instance. / 建立完成的高階 ChartDocument 執行個體。

Exceptions

ArgumentNullException

Thrown when chartDefinition is null. / 當 chartDefinitionnull 時擲出。

CreateBubble(string?, params OdfBubbleChartSeriesRequest[])

Creates a bubble chart document from explicit series requests. 以明確序列要求建立泡泡圖文件。

public static ChartDocument CreateBubble(string? title, params OdfBubbleChartSeriesRequest[] series)

Parameters

title string

The optional chart title. / 選用的圖表標題。

series OdfBubbleChartSeriesRequest[]

The bubble chart series requests. / 泡泡圖序列要求。

Returns

ChartDocument

The created ChartDocument. / 建立完成的 ChartDocument

CreateFromFlatDocument(FlatChartDocument)

Creates an equivalent ODC (ZIP package) chart document from a FODC flat XML chart document, with identical content. 從 FODC 扁平 XML 圖表文件建立等價的 ODC(ZIP 封裝)圖表文件,內容完全相同。

public static ChartDocument CreateFromFlatDocument(FlatChartDocument document)

Parameters

document FlatChartDocument

The source FODC flat XML chart document. / 來源 FODC 扁平 XML 圖表文件。

Returns

ChartDocument

The created ChartDocument instance. / 建立完成的 ChartDocument 執行個體。

CreateFromTemplate(ChartTemplateDocument)

Creates a new high-level chart document from the specified chart template document. 從指定的圖表範本文件建立新的高階圖表文件。

public static ChartDocument CreateFromTemplate(ChartTemplateDocument template)

Parameters

template ChartTemplateDocument

The chart template document. / 圖表範本文件。

Returns

ChartDocument

The created ChartDocument instance. / 建立完成的 ChartDocument 執行個體。

CreateStock(string?, params OdfStockChartSeriesRequest[])

Creates a stock chart document from explicit OHLC series requests. 以明確 OHLC 序列要求建立股票圖文件。

public static ChartDocument CreateStock(string? title, params OdfStockChartSeriesRequest[] series)

Parameters

title string

The optional chart title. / 選用的圖表標題。

series OdfStockChartSeriesRequest[]

The stock chart series requests. / 股票圖序列要求。

Returns

ChartDocument

The created ChartDocument. / 建立完成的 ChartDocument

FromTable(string, OdfCellRange)

Short overload of FromTable that accepts sheetName and range; remaining optional parameters use defaults and forward to the full overload. 便利多載:提供 sheetName 與 range;其餘可選參數使用預設值並轉呼叫最長 FromTable 多載。

public static ChartDocument FromTable(string sheetName, OdfCellRange range)

Parameters

sheetName string
range OdfCellRange

Returns

ChartDocument

FromTable(string, OdfCellRange, OdfChartPreset)

Short overload of FromTable that accepts sheetName, range, and preset; remaining optional parameters use defaults and forward to the full overload. 便利多載:提供 sheetName、range 與 preset;其餘可選參數使用預設值並轉呼叫最長 FromTable 多載。

public static ChartDocument FromTable(string sheetName, OdfCellRange range, OdfChartPreset preset)

Parameters

sheetName string
range OdfCellRange
preset OdfChartPreset

Returns

ChartDocument

FromTable(string, OdfCellRange, OdfChartPreset, string?)

Short overload of FromTable that accepts sheetName, range, preset, and title; remaining optional parameters use defaults and forward to the full overload. 便利多載:提供 sheetName、range、preset 與 title;其餘可選參數使用預設值並轉呼叫最長 FromTable 多載。

public static ChartDocument FromTable(string sheetName, OdfCellRange range, OdfChartPreset preset, string? title)

Parameters

sheetName string
range OdfCellRange
preset OdfChartPreset
title string

Returns

ChartDocument

FromTable(string, OdfCellRange, OdfChartPreset, string?, bool)

Short overload of FromTable that accepts sheetName, range, preset, title, and firstRowAsHeader; remaining optional parameters use defaults and forward to the full overload. 便利多載:提供 sheetName、range、preset、title 與 firstRowAsHeader;其餘可選參數使用預設值並轉呼叫最長 FromTable 多載。

public static ChartDocument FromTable(string sheetName, OdfCellRange range, OdfChartPreset preset, string? title, bool firstRowAsHeader)

Parameters

sheetName string
range OdfCellRange
preset OdfChartPreset
title string
firstRowAsHeader bool

Returns

ChartDocument

FromTable(string, OdfCellRange, OdfChartPreset, string?, bool, bool)

Creates a chart document from a spreadsheet-style table range and a practical preset. 以試算表表格範圍與實務預設建立圖表文件。

public static ChartDocument FromTable(string sheetName, OdfCellRange range, OdfChartPreset preset, string? title, bool firstRowAsHeader, bool firstColumnAsLabel)

Parameters

sheetName string

The sheet name. / 工作表名稱。

range OdfCellRange

The source cell range. / 來源儲存格範圍。

preset OdfChartPreset

The chart preset. / 圖表預設。

title string

The optional chart title. / 選用的圖表標題。

firstRowAsHeader bool

Whether the first row is treated as series labels. / 首列是否視為序列標籤。

firstColumnAsLabel bool

Whether the first column is treated as category labels. / 首欄是否視為分類標籤。

Returns

ChartDocument

The created ChartDocument. / 建立完成的 ChartDocument

Load(Stream)

Loads a high-level chart document from the specified stream. 從指定資料流載入高階圖表文件。

public static ChartDocument Load(Stream stream)

Parameters

stream Stream

Returns

ChartDocument

The loaded high-level ChartDocument instance. / 載入完成的高階 ChartDocument 執行個體。

Load(Stream, string?)

Full overload of Load that accepts stream and fileName. Load 完整多載:接受 stream 與 fileName。

public static ChartDocument Load(Stream stream, string? fileName)

Parameters

stream Stream
fileName string

Returns

ChartDocument

Load(string)

Loads a high-level chart document from the specified file path. 從指定檔案路徑載入高階圖表文件。

public static ChartDocument Load(string path)

Parameters

path string

The ODC document file path. / ODC 文件檔案路徑。

Returns

ChartDocument

The loaded high-level ChartDocument instance. / 載入完成的高階 ChartDocument 執行個體。

LoadAsync(Stream)

Asynchronously loads a high-level chart document from the specified stream. 非同步從指定資料流載入高階圖表文件。

public static Task<ChartDocument> LoadAsync(Stream stream)

Parameters

stream Stream

Returns

Task<ChartDocument>

A task representing the asynchronous load operation, whose result is the loaded high-level ChartDocument. / 代表非同步載入作業的工作,其結果為載入完成的高階 ChartDocument

LoadAsync(Stream, string?)

Short overload of LoadAsync that accepts stream and fileName; remaining optional parameters use defaults and forward to the full overload. 便利多載:提供 stream 與 fileName;其餘可選參數使用預設值並轉呼叫最長 LoadAsync 多載。

public static Task<ChartDocument> LoadAsync(Stream stream, string? fileName)

Parameters

stream Stream
fileName string

Returns

Task<ChartDocument>

LoadAsync(Stream, string?, CancellationToken)

Short overload of LoadAsync that accepts stream, fileName, and cancellationToken; remaining optional parameters use defaults and forward to the full overload. 便利多載:提供 stream、fileName 與 cancellationToken;其餘可選參數使用預設值並轉呼叫最長 LoadAsync 多載。

public static Task<ChartDocument> LoadAsync(Stream stream, string? fileName, CancellationToken cancellationToken)

Parameters

stream Stream
fileName string
cancellationToken CancellationToken

Returns

Task<ChartDocument>

LoadAsync(Stream, CancellationToken)

Asynchronously loads the document from a stream with a cancellation token. 以取消語彙基元非同步從資料流載入文件。

public static Task<ChartDocument> LoadAsync(Stream stream, CancellationToken cancellationToken)

Parameters

stream Stream

The document stream. / 文件資料流。

cancellationToken CancellationToken

The cancellation token. / 取消語彙基元。

Returns

Task<ChartDocument>

A task whose result is the loaded document. / 代表非同步載入作業的工作,其結果為載入完成的文件。

LoadAsync(string)

Asynchronously loads a high-level chart document from the specified file path. 非同步從指定檔案路徑載入高階圖表文件。

public static Task<ChartDocument> LoadAsync(string path)

Parameters

path string

Returns

Task<ChartDocument>

A task representing the asynchronous load operation, whose result is the loaded high-level ChartDocument. / 代表非同步載入作業的工作,其結果為載入完成的高階 ChartDocument

LoadAsync(string, CancellationToken)

Short overload of LoadAsync that accepts path and cancellationToken; remaining optional parameters use defaults and forward to the full overload. 便利多載:提供 path 與 cancellationToken;其餘可選參數使用預設值並轉呼叫最長 LoadAsync 多載。

public static Task<ChartDocument> LoadAsync(string path, CancellationToken cancellationToken)

Parameters

path string
cancellationToken CancellationToken

Returns

Task<ChartDocument>

UpdateData(IEnumerable<IEnumerable<object?>>)

Updates the chart's embedded local data table (local cached data). 更新圖表內嵌的本地資料表格(本地快取資料)。

public void UpdateData(IEnumerable<IEnumerable<object?>> data)

Parameters

data IEnumerable<IEnumerable<object>>

The two-dimensional data collection, including labels and values. / 二維資料集合,包含標籤與數值。

Exceptions

ArgumentNullException

Thrown when data is null. / 當 datanull 時擲出。