# ChartCollection.getById Method

> ChartCollection.getById method in the TX Sheet Control JavaScript API for Node.js: Find by chart identity. Includes the syntax and a JavaScript example.

- **Product:** TX Sheet Control
- **Section:** Documentation
- **Kind:** Method
- **Path:** TX Sheet Control > API Reference > JavaScript API > Node.js Server > ChartCollection > ChartCollection.getById Method
- **547 words**
- **Web URL:** https://docs.textcontrol.com/tx-sheet-control/reference/javascript-api/nodejs/chartcollection/getbyid-method/
- **LLMs URL:** https://docs.textcontrol.com/tx-sheet-control/reference/javascript-api/nodejs/chartcollection/getbyid-method/llms.txt
- **LLMs-Full URL:** https://docs.textcontrol.com/tx-sheet-control/reference/javascript-api/nodejs/chartcollection/getbyid-method/llms-full.txt

---

Find by chart identity.

Owner: [ChartCollection](https://docs.textcontrol.com/tx-sheet-control/reference/javascript-api/nodejs/chartcollection/llms-full.txt). Package: `@txtextcontrol/tx-sheet-control-server`. Version: **2.0.0**.

### Syntax

```javascript
owner.getById(id)
```

### Parameters

| Parameter | Type | Optional | Description |
|---|---|---|---|
| `id` | `string` | No | Operation-specific input; see the owning type for units and scope. |

### Return Value

`Chart`.

A detached result or a handle bound to the same worksheet.

### Examples

Use a fresh sample workbook for this example. In the browser pass editor.workbook; in Node.js pass the server control. Document-bound objects are obtained from that same owner.

```javascript
function demonstrateChartCollectionGetById(control) {
    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' });
    return sheet.charts.getById(chart.id).title;
}
```

### Remarks

Use this member on an object from the current document. Reacquire document-bound handles after replacement/deletion. Validate arguments against the declared types and documented bounds; handle exceptions or rejected promises.

### See Also

- [ChartCollection Class](https://docs.textcontrol.com/tx-sheet-control/reference/javascript-api/nodejs/chartcollection/llms-full.txt)
- [Charts and Sparklines](https://docs.textcontrol.com/tx-sheet-control/spreadsheets/charts/llms-full.txt)
- [Chart Interface](https://docs.textcontrol.com/tx-sheet-control/reference/typescript-api/nodejs/chart/llms-full.txt)

---

## Nearby

- **Previous:** [ChartCollection.get Method](https://docs.textcontrol.com/tx-sheet-control/reference/javascript-api/nodejs/chartcollection/get-method/llms-full.txt)
- **Next:** [ChartCollection.remove Method](https://docs.textcontrol.com/tx-sheet-control/reference/javascript-api/nodejs/chartcollection/remove-method/llms-full.txt)
