How to bind the data source via chart wizard ?
Chart wizard allows us to customize the chart during design time. Follow the below steps to bind data source with chart during design-time
After binding the chart with data source, designer will display chart with random data. During run-time, you can see the chart with data from data source bounded in designer.
Step-1:
Open the Chart Wizard in designer. Chart wizard can be opened either by right-clicking the Chart control and choosing the Chart Wizard option in context menu or by clicking Chart Wizard option in smart tag of the Chart control. Chart wizard appears as follows.
Step-2:
In Chart Wizard, click Series button and click Data Source tab to choose the data source.
Step-3:
The combo box displays all the available data sources in the Form. Choose the data source for Chart from the data sources available in the combo box.
When Form does not contain any data source, then only [none] and [new Binding Source…] options are present in the combo box. We assume that the form already contains the data source required for chart. Refer Binding chart to a data base using chart wizard for binding chart with a new data source.
Here, MyBindingSource is a binding source present in the form.
Step-4:
Click Series Data tab to map the data source fields with X and Y values of the Chart. Select a series in the combo box and other fields in this tab are enabled.
Step-5:
In the X Value combo box, choose the field that should be bound with the X value of series. Similarly, in Y Value combo box, choose the field that should be bound with the Y value of the series and click Finish button.
You can also change series Type and Name here.
Designer displays default chart with random values but you can see the series bounded with binding source after running the application as in below screenshot.