The KaxChart control from our ASP.NET AJAX allows users to bind web chart to both simple and complex list. In this tutorial, we will offer you three programming examples to show three major situations of data binding chart to list, which are chart data binding with simple list, chart data binding with list of objects and chart data binding with collection list.
To bind a KaxChart to a list, you need first change the DataSource property of the chart to list type. Then you can specify the desired list objects using the chart DataBind() method. Please view the free online demo for chart data binding with list objects.
By the way, please make sure that your ASP.NET web application has installed NET Framework 3.5 or above versions and that you have installed all the necessary dlls from our ASP.NET AJAX SDK into your ASP.NET web application.
Data Binding Chart to Simple List
The simple list refers to the list that is made up of simple types, e.g. int and double modes. And in this part, we mainly illustrate how to add double list data to asp.net chart control.
C# sample code:
Here we attach an image that shows the general output of above application for binding chart to simple list. You can find the data items in the list shows in the web chart diagram.
Data Binding Chart to List of Objects
In real life application, we may meet the need to bind chart to a list that is composed of complex data objects (for instance, the data object may contain multiple properties). And one of the common complex lists is the list of object which allows users to add data via Class. And following code is offered to show how to bind chart to the data from list of objects.
C# example code:
Here we attach an image that shows the general output of above application for binding chart to list of objects. In the chart graphs, there are two groups of data. One is amount data, it shows in light green line, the other is ID, you can find it at the bottom of the plot area of chart view as a blue line. So Kettic asp.net chart control can display multiple grouped data series, while the input list of objects has multiple properties.
Data Binding Chart to Collection List
Collection list can be also counted as a type of complex list. This list type allows users to add data via CollectionBase. Following programming code is specifically provided for the chart data bind with collection list.
C# sample code:
Here we attach an image that shows the general output of above application for binding chart to collection list. The data in the collection is a list of double values, and these values add dynamicly to the asp.net chart through the server side programming code.
In this tutorial, all the examples are showing line chart type in ajax. And our asp.net chart control supply some extra chart types: pie chart, bar chart, stacked chart, point chart, gantt chart and so on.
If you have any problem in the process of data binding chart to any type of list, please feel free to contact us via E-mail.
Other Recommended Data Binding Applications
ASP.NET AJAX UI Controls