I have this chart:
<telerik:RadCartesianChart Name="myChart">
I have this chart:
<telerik:RadCartesianChart Name="myChart"> <telerik:RadCartesianChart.Grid> <telerik:CartesianChartGrid MajorLinesVisibility="XY"/> </telerik:RadCartesianChart.Grid> <telerik:RadCartesianChart.HorizontalAxis> <telerik:LogarithmicAxis LogarithmBase="2" Minimum="125" Maximum="8000"/> </telerik:RadCartesianChart.HorizontalAxis> <telerik:RadCartesianChart.VerticalAxis> <telerik:LinearAxis Maximum="10" Minimum="-130"/> </telerik:RadCartesianChart.VerticalAxis> <telerik:RadCartesianChart.Series> <telerik:ScatterLineSeries> <telerik:ScatterLineSeries.DataPoints> <telerik:ScatterDataPoint YValue="-40" XValue="125"/> <telerik:ScatterDataPoint YValue="-50" XValue="250"/> <telerik:ScatterDataPoint YValue="-60" XValue="500"/> <telerik:ScatterDataPoint YValue="-70" XValue="1000"/> <telerik:ScatterDataPoint YValue="-80" XValue="2000"/> <telerik:ScatterDataPoint YValue="-70" XValue="4000"/> </telerik:ScatterLineSeries.DataPoints> </telerik:ScatterLineSeries> </telerik:RadCartesianChart.Series></telerik:RadCartesianChart>And in my code i have timer that receive data every second:
private Random random = null;Create timer:
random = new Random(); System.Windows.Threading.DispatcherTimer dispatcherTimer = new System.Windows.Threading.DispatcherTimer(); dispatcherTimer.Tick += dispatcherTimer_Tick; dispatcherTimer.Interval = new TimeSpan(0, 0, 1); dispatcherTimer.Start();Timer tick:
private void dispatcherTimer_Tick(object sender, EventArgs e){ int val = random.Next(0, 100); line.DataPoints.Add(new CategoricalDataPoint() { Value = val });}I all i want to to (i am totally new with WPF) is to replace my hard coded values in my XAML in the real time data that the timer received (the 'val' variable).
My timer is define only in the code and not in XAML.
How can i do that ?