We use cookies to give you the best experience on our website. If you continue to browse, then you agree to our privacy policy and cookie policy. Image for the cookie policy date
Unfortunately, activation email could not send to your email. Please try again.
Syncfusion Feedback

How to bind data table in WPF Chart (SfChart)?

Platform: WPF |
Control: SfChart |
Published Date: October 27, 2015 |
Last Revised Date: July 2, 2021 |
.NET Framework: 4.5.1 |
Product Version:

The DataTable type can be bound to the ItemsSource property in WPF Chart (SfChart).


<Grid x:Name="grid">
            <chart:ColumnSeries ItemsSource="{Binding Data}" XBindingPath="ProductName" YBindingPath="UnitsInStock"></chart:ColumnSeries>


public class DataViewModel 
  DataSet dataset = new DataSet();
  public DataViewModel()
  public void AddData()
    //Sets Database connection.
    string connectionString = string.Format("Provider=Microsoft.Jet.OLEDB.4.0; Data Source={0}", @"..\..\Model\DataBase_File.mdb");
    OleDbConnection Connection = new OleDbConnection(connectionString);
    OleDbCommand command = new OleDbCommand("Select Top 10 * from [Products]", Connection);
    OleDbDataAdapter DataAdapter = new OleDbDataAdapter(command);
    DataAdapter.Fill(dataset, "Product");
    //Sets the DataTable to Data property.
    this.Data = dataset.Tables["Product"];
  public DataTable _data;
  public DataTable Data
      return _data;
      _data = value;

WPF Chart with Binding Data from DataTable


2X faster development

The ultimate WPF UI toolkit to boost your development speed.
You must log in to leave a comment
skanoko siame
Aug 23, 2018

So after linking the database to the chart, how do you go about loading data from the database in real or quick time?

Muneesh Kumar G [Syncfusion]
Aug 24, 2018

Hi Skanoko siame,


We have analyzed your requirement and you can achieve this by changing the DataTable collection, which is bind to series ItemsSource as per the below code snippet.


Code snippet [C#]:

DispatcherTimer timer = new DispatcherTimer();

        DataViewModel viewModel = new DataViewModel();

        Random rd = new Random();

        string[] names;

        public MainWindow()




            series.ItemsSource = viewModel.Data;


            names = new string[] { "Chang", "Ikura", "Kobe", "Peas", "Pepper" };


            timer.Tick += timer_Tick;

            timer.Interval = new TimeSpan(0, 0, 0, 0, 100);



        void timer_Tick(object sender, EventArgs e)



            viewModel.Data.Rows.Add(new Object[] { names[rd.Next(0,4)], rd.Next(4,20) });



We have prepared a sample based on this, please find the sample from the following location.


Sample: http://www.syncfusion.com/downloads/support/forum/134727/ze/SfChart_DataTable1269039968.zip


Hope this helps.



Muneesh Kumar G.


Please sign in to access our KB

This page will automatically be redirected to the sign-in page in 10 seconds.

Up arrow icon

Warning Icon You are using an outdated version of Internet Explorer that may not display all features of this and other websites. Upgrade to Internet Explorer 8 or newer for a better experience.Close Icon

Live Chat Icon For mobile