Class ChartDocument
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
packageOdfPackageThe 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
packageOdfPackageThe ODF package instance. / ODF 封裝執行個體。
subPathstringThe 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
chartDefinitionOdfChartDefinitionThe chart configuration and definition information. / 圖表設定與定義資訊。
Returns
- ChartDocument
The created high-level ChartDocument instance. / 建立完成的高階 ChartDocument 執行個體。
Exceptions
- ArgumentNullException
Thrown when
chartDefinitionis null. / 當chartDefinition為 null 時擲出。
CreateBubble(string?, params OdfBubbleChartSeriesRequest[])
Creates a bubble chart document from explicit series requests. 以明確序列要求建立泡泡圖文件。
public static ChartDocument CreateBubble(string? title, params OdfBubbleChartSeriesRequest[] series)
Parameters
titlestringThe optional chart title. / 選用的圖表標題。
seriesOdfBubbleChartSeriesRequest[]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
documentFlatChartDocumentThe 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
templateChartTemplateDocumentThe 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
titlestringThe optional chart title. / 選用的圖表標題。
seriesOdfStockChartSeriesRequest[]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
sheetNamestringrangeOdfCellRange
Returns
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
sheetNamestringrangeOdfCellRangepresetOdfChartPreset
Returns
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
sheetNamestringrangeOdfCellRangepresetOdfChartPresettitlestring
Returns
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
sheetNamestringrangeOdfCellRangepresetOdfChartPresettitlestringfirstRowAsHeaderbool
Returns
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
sheetNamestringThe sheet name. / 工作表名稱。
rangeOdfCellRangeThe source cell range. / 來源儲存格範圍。
presetOdfChartPresetThe chart preset. / 圖表預設。
titlestringThe optional chart title. / 選用的圖表標題。
firstRowAsHeaderboolWhether the first row is treated as series labels. / 首列是否視為序列標籤。
firstColumnAsLabelboolWhether 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
streamStream
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
Returns
Load(string)
Loads a high-level chart document from the specified file path. 從指定檔案路徑載入高階圖表文件。
public static ChartDocument Load(string path)
Parameters
pathstringThe 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
streamStream
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
Returns
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
streamStreamfileNamestringcancellationTokenCancellationToken
Returns
LoadAsync(Stream, CancellationToken)
Asynchronously loads the document from a stream with a cancellation token. 以取消語彙基元非同步從資料流載入文件。
public static Task<ChartDocument> LoadAsync(Stream stream, CancellationToken cancellationToken)
Parameters
streamStreamThe document stream. / 文件資料流。
cancellationTokenCancellationTokenThe 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
pathstring
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
pathstringcancellationTokenCancellationToken
Returns
UpdateData(IEnumerable<IEnumerable<object?>>)
Updates the chart's embedded local data table (local cached data). 更新圖表內嵌的本地資料表格(本地快取資料)。
public void UpdateData(IEnumerable<IEnumerable<object?>> data)
Parameters
dataIEnumerable<IEnumerable<object>>The two-dimensional data collection, including labels and values. / 二維資料集合,包含標籤與數值。