TX Sheet Control

ChartObjectOptions Interface

Interface

Chart creation settings with worksheet-bound anchors and unscaled CSS pixel dimensions.

Package: @txtextcontrol/tx-sheet-control. Version: 2.0.0.

Type-only declaration; it is not a JavaScript runtime constructor.

Members

Properties

PropertyDescription
anchorThe anchor value of ChartObjectOptions.
axisTitlesThe axisTitles value of ChartObjectOptions.
colorsThe colors value of ChartObjectOptions.
dataRangeThe dataRange value of ChartObjectOptions.
elementsThe elements value of ChartObjectOptions.
filtersThe filters value of ChartObjectOptions.
idThe id value of ChartObjectOptions.
legendThe legend value of ChartObjectOptions.
originThe origin value of ChartObjectOptions.
seriesThe series value of ChartObjectOptions.
seriesOrientationThe seriesOrientation value of ChartObjectOptions.
sizeThe size value of ChartObjectOptions.
styleThe style value of ChartObjectOptions.
titleThe title value of ChartObjectOptions.
typeThe type value of ChartObjectOptions.
presentationConfigure chart layout, independent axes and native labels.

Examples

Use a fresh workbook. Create and format the sample data, apply this API and retain the returned document or result in your application. In the browser pass editor.workbook; in Node.js pass the server control.

import type { Workbook } from '@txtextcontrol/tx-sheet-control';
import type { ChartObjectOptions } from '@txtextcontrol/tx-sheet-control';

function createChartObjectOptionsReport(book: 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 chartObjectSettings: ChartObjectOptions = {
        anchor: { cell: 'D2' },
        size: { width: 640, height: 360 },
        title: 'Revenue by region',
        type: 'column',
        dataRange: 'A1:B5',
    };

    sheet.charts.add(chartObjectSettings);
    return sheet;
}

See Also