TX Sheet Control

Chart Interface

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

PropertyDescription
axisTitlesThe axisTitles value of Chart.
colorsThe colors value of Chart.
dataRangeThe dataRange value of Chart.
elementsThe elements value of Chart.
filtersThe filters value of Chart.
idThe id value of Chart.
legendThe legend value of Chart.
originThe origin value of Chart.
positionThe position value of Chart.
seriesThe series value of Chart.
seriesOrientationThe seriesOrientation value of Chart.
styleThe style value of Chart.
titleThe title value of Chart.
typeThe type value of Chart.
presentationConfigure 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;
}

See Also