You can indeed make a LineSeries
data dynamic. This is accomplished by working with a bound ObservableCollection<T>
and adding items dynamically. Whatever changes you make to that collection will be shown in the series.
To explain better, I have built you a small demo (attached) that adds a new data point to the LineSeries every half second using a timer.
Run the attached app and click the "Start" button, you'll see the data points get plotted on a DateTimeContinuousAxis
. As new data points get added they're plotted to the right of the previous one because I use DateTime.Now
, the axis will render it to the right of the previous point.
After you're run the app, go to MainViewModel.cs
and examine the AddDataPoint()
/// this method gets run every 500 milliseconds and increases or decreases the line
private void AddDataPoint()
var valueToUse = incrementingInt % 2 == 0 ? incrementingInt++ : -incrementingInt++;
var nextDataPoint = new ChartDataPoint
DataTimestamp = DateTime.Now,
DataValue = valueToUse
//To keep the demo from getting too large, I keep the datapoints to within 30
//this keep the the Chart scrolling along
As you can see, I do not interact with the ChartView or the Series directly, instead the changes are made to the bound collection.
Additionally, you can configure the DateTimeContinuousAxis to display the values to your needs, see here for more information
If you have any further questions, please let us know.
Lance | Tech Support Engineer, Sr.
Telerik by Progress
Do you need help with upgrading your AJAX, WPF or WinForms project? Check the Telerik API Analyzer
and share your thoughts.