Chart Interface
A worksheet-bound chart handle. Data references are resolved by the workbook calculation engine.
Package: @txtextcontrol/tx-sheet-control-server. Version: 2.0.0.
Related workbook object-model type, returned through the server control. Obtain it from its owning workbook or collection; it is not a required browser-package import.
Members
Properties
| Property | Description |
|---|---|
| axisTitles | The axisTitles value of Chart. |
| colors | The colors value of Chart. |
| dataRange | The dataRange value of Chart. |
| elements | The elements value of Chart. |
| filters | The filters value of Chart. |
| id | The id value of Chart. |
| legend | The legend value of Chart. |
| origin | The origin value of Chart. |
| position | The position value of Chart. |
| series | The series value of Chart. |
| seriesOrientation | The seriesOrientation value of Chart. |
| style | The style value of Chart. |
| title | The title value of Chart. |
| type | The type value of Chart. |
| presentation | Configure chart layout, independent axes and native labels. |
Examples
Create sample data and obtain this detached result from the owning document. Return the selected data to the report or application UI.
import type { ServerSheetControl } from '@txtextcontrol/tx-sheet-control-server';
function createChartReport(control: ServerSheetControl) {
const book = control.workbook;
const sheet = book.sheets.at(0);
sheet.range('A1:B5').setValues([
['Region', 'Revenue'],
['North', 42000],
['South', 38500],
['East', 31200],
['West', 44900],
]);
const chart = sheet.charts.add({
type: 'column',
title: 'Revenue by region',
dataRange: 'A1:B5',
anchor: { cell: 'D2' },
size: { width: 480, height: 240 },
});
const result = chart.snapshot;
return result;
}