# Data Binding

You can bind the Sankey Chart to data by using the component's [`data`](https://www.telerik.com/kendo-react-ui/components/charts/api/sankeyprops#data) property. This property requires your data to match the [`SankeyData`](https://www.telerik.com/kendo-react-ui/components/charts/api/sankeydata) format. However, if your data has a different format, you must process and structure it before feeding it to the component.

## Binding to SankeyData

The following example demonstrates how to set the [`data`](https://www.telerik.com/kendo-react-ui/components/charts/api/sankeyprops#data) property to data with the [`SankeyData`](https://www.telerik.com/kendo-react-ui/components/charts/api/sankeydata) format. The data is located in the `data.ts` file.

[Demo Source](https://demos.telerik.com/kendo-react-ui/charts/sankey/overview/source.txt)

## Binding to Flat Data

When the data is present as an array of objects, it needs to be transformed to the `SankeyData` format.

This is achieved in the below example using the `createSankeyData` method. It takes an array of data, `dimensions`, and `measure` as input parameters and returns an object that conforms to the `SankeyData` interface. The `dimensions` refer to the Sankey `nodes` while the `measure` refers to the value that will be used to set the value of the `links`.

[Demo Source](https://demos.telerik.com/kendo-react-ui/charts/sankey/data-binding/datasets-of-objects/source.txt)

## Customize Nodes from Flat Data

To [customize the element instances](https://www.telerik.com/kendo-react-ui/components/charts/sankey/customization#customizing-element-instances) when the data is an array of objects, transform the `data` that stores the returned value of the `createSankeyData` method.

The following example demonstrates this approach by mapping the `data.nodes` to set the color to `lightblue` for the nodes with an even id, and `lightgreen` for the nodes with an odd id.

[Demo Source](https://demos.telerik.com/kendo-react-ui/charts/sankey/data-binding/customize-elements/source.txt)

## Suggested Links

* [API Reference of the Charts](https://www.telerik.com/kendo-react-ui/components/charts/api)
* [API Reference of the Sankey chart](https://www.telerik.com/kendo-react-ui/components/charts/api/sankeyprops)
