Skip to main content

ChartControl.RefreshData() Method

Reloads data from the underlying data source and repaints the diagram area.

Namespace: DevExpress.XtraCharts

Assembly: DevExpress.XtraCharts.v22.2.UI.dll

NuGet Package: DevExpress.Win.Charts


public void RefreshData()


If a data source implements the IBindingList, INotifyCollectionChanged or DevExpress.Data.ChartDataSources.IChartDataSource interface, XtraCharts refreshes a chart’s data only when data in the data source has been changed. If the data source does not implement these interfaces, you can manually handle the way in which chart data should be refreshed via the ChartControl.RefreshDataOnRepaint property.


In the following code, a new data point is added to a data source when a user clicks the Add Point button. The Chart Control uses a data source of the List<T> type that does not implement previously mentioned interfaces. For this reason, you should call the RefreshData method to notify the chart about the data source changes and make the chart re-render the diagram area.

using DevExpress.XtraCharts;
using System;
using System.Collections.Generic;
using System.Windows.Forms;

namespace ChartExample {
    public partial class Form1 : Form {
        Random rand = new Random();
        List<DataPoint> data;
        public Form1() {
            data = GetPoints();
        private void Form1_Load(object sender, EventArgs e) {
            Series series = new Series("Series 1", ViewType.Line);
            series.DataSource = data;
            series.ArgumentDataMember = "Argument";

            XYDiagram diagram = chartControl1.Diagram as XYDiagram;
            diagram.AxisX.DateTimeScaleOptions.ScaleMode = ScaleMode.Continuous;

            LineSeriesView view = (LineSeriesView)series.View;
            view.MarkerVisibility = DevExpress.Utils.DefaultBoolean.True;

        private void OnAddPointButtonClick(object sender, EventArgs e) {
            data.Add(new DataPoint(DateTime.Now, rand.NextDouble() * 50));

        public List<DataPoint> GetPoints() {
             return new List<DataPoint> {
                new DataPoint(DateTime.Now.AddSeconds(- 5), 56.1226),
                new DataPoint(DateTime.Now.AddSeconds(- 4), 50.18432),
                new DataPoint(DateTime.Now.AddSeconds(- 3), 51.51443),
                new DataPoint(DateTime.Now.AddSeconds(- 2), 60.2624),
                new DataPoint(DateTime.Now.AddSeconds(- 1), 65.6321)};

        public class DataPoint {
            public DateTime Argument { get; set; }
            public double Value { get; set; }
            public DataPoint(DateTime argument, double value) {
                this.Argument = argument;
                this.Value = value;
See Also