| FlexChart > Working with FlexChart > Data > Providing Data > Binding Data Using a Data Source > Binding Data to FlexChart |
Data is bound to FlexChart through the following steps: setting the DataSource property and setting the BindingX and the Binding property.
At Design-Time
Set the DataSource property at design-time by performing the following steps:

In Code
Set the DataSource property by using the following code:
FlexChart1.DataSource = bindingSource1
flexChart1.DataSource = bindingSource1;
![]() |
You can set the DataSource property both at the chart level and at the series level. To set the property at the series level, navigate to Series in the Properties window. Click the Ellipsis button and open Series Collection Editor. Then, navigate to the DataSource property, and select the relevant data source from the drop-down list box. |
Once you have set the DataSource property, you need to specify the fields to apply to the data series in the chart. In simple terms, you need to specify the fields to set data values for primary X and Y arrays and also for secondary Y arrays (depending upon the chart type).
You need to set the BindingX property to the field containing X values and the Binding property to the field(s) containing Y values.
At Design-Time
Perform the following steps:
In Code
Use the following code to set the BindingX and the Binding property at run-time:
FlexChart1.BindingX = "Id" series1.Binding = "Sum" series2.Binding = "Cost"
flexChart1.BindingX = "Id"; series1.Binding = "Sum"; series2.Binding = "Cost";
![]() |
Like the DataSource property, you can set the Binding X and the Binding property at the chart as well as the series level. To set the properties at the series level, navigate to Series in the Properties window and click the Ellipsis button next to Series. In Series Collection Editor, navigate to the BindingX and the Binding property. Then, select the appropriate fields from the drop-down list box of the properties. |