# Data Binding

You can bind the Sankey Chart to data by using the component's [`dataNodes`](https://www.telerik.com/kendo-vue-ui/components/charts/api/sankeyprops#datanodes) and [`dataLinks`](https://www.telerik.com/kendo-vue-ui/components/charts/api/sankeyprops#datalinks) properties. They require your data to be in specific 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 in the required format.

[Demo Source](https://demos.telerik.com/kendo-vue-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 [`dataNodes`](https://www.telerik.com/kendo-vue-ui/components/charts/api/sankeyprops#datanodes) and [`dataLinks`](https://www.telerik.com/kendo-vue-ui/components/charts/api/sankeyprops#datalinks) 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 `dataNodes` and `dataLinks` interfaces. 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-vue-ui/charts/sankey/data-binding/datasets-objects/source.txt)

## Customize Nodes from Flat Data

To [customize the element instances](https://www.telerik.com/kendo-vue-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 `dataNodes` 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-vue-ui/charts/sankey/data-binding/datasets-customize-objects/source.txt)

## Suggested Links

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