Real Time Chart binded from MVVM
Hello
I have an MVVM which it binded to the GUI.
The binded variables are appeared and working perfectly with textblock.
The Model called "Parameters" and the View Model "ParametersModel". I created a new a Parameter Model in the main class.
Then after pressing a "Start" button the thread will start. This is thread is used to change the values.
Then after pressing a "Start" button the thread will start. This is thread is used to change the values.
There is a for loop with counter 360 and I am calculating in each parameter the math functions sin, cos, and tan.
public void AutoIncrement()
{
while (!flagStop)
{
for (int i = 0; i < 360; i++)
{
_parametersModel.Value1 = Math.Sin((double)i);
_parametersModel.Value2 = Math.Cos((double)i);
_parametersModel.Value3 = Math.Tan((double)i);
}
}
flagStop = false;
}
And when the stop button presses the flagStop will become true then the thread will stop. And all the changes appeared directly on the GUI using binding data.
Actually, I want to draw a real time chart using this data corresponding to time.
I have made a simple project with the same concept of the target project.
Please kindly find the attached project.
Thanks for your attention and waiting your reply.
Best regards,
M. TAHOUN
Attachment: Tutorial_Chart_b19c5b12.rar
SIGN IN To post a reply.
3 Replies
SR
Samuel Rajadurai Edwin Rajamanickam
Syncfusion Team
April 29, 2016 01:11 PM UTC
Hi Tahoun,
Thanks for contacting Syncfusion Support.
We have achieved your requirement to load data to the chart in real time. Kindly find the modified sample from the below link.
http://www.syncfusion.com/downloads/support/forum/123874/ze/Tutorial_Chart2034172376
For more information about the SfChart, please refer the below documentation link.
http://help.syncfusion.com/wpf/sfchart/overview
Regards,
Samuel
MT
Mohamed Tahoun
May 3, 2016 12:33 PM UTC
Hello Samuel
Thanks for you fast reply.
But I actually this not the thing I want.
I need to draw the same parameters in the model.
Actually, my target application to read from the sensor and update the data online on the text box, labels or anything and to draw real time chart of the output data corresponding to the actual time.
In my target application, I have a model for the parameters that I will read from the sensor and the updating of the values on the GUI is worked perfectly. So, assume that the data from the sensor is Value1, Value2 and value 3 in the attached sample project.
So, I need to display these values on the GUI and draw them on a real time chart.
Also, I think that using threading is more efficient than timer, because I have to use at least two threads in addition to the GUI one and the chart one. I am not sure of this, What do you think about this?
Does it possible to something like this?
Thanks for you fast reply.
But I actually this not the thing I want.
I need to draw the same parameters in the model.
Actually, my target application to read from the sensor and update the data online on the text box, labels or anything and to draw real time chart of the output data corresponding to the actual time.
In my target application, I have a model for the parameters that I will read from the sensor and the updating of the values on the GUI is worked perfectly. So, assume that the data from the sensor is Value1, Value2 and value 3 in the attached sample project.
So, I need to display these values on the GUI and draw them on a real time chart.
Also, I think that using threading is more efficient than timer, because I have to use at least two threads in addition to the GUI one and the chart one. I am not sure of this, What do you think about this?
Does it possible to something like this?
Thanks and waiting your reply.
Best regards,
M. TAHOUN
Best regards,
M. TAHOUN
SR
Samuel Rajadurai Edwin Rajamanickam
Syncfusion Team
May 4, 2016 03:06 PM UTC
Hi Tahoun,
Thanks for the update.
Chart renders based on IEnumerable/Datatable type which bound in the ItemsSource property in chart series. Currently there is no provision to render chart based on properties alone. Please provide more information on your requirement with the data visualization in chart, probably a pictorial representation which will be helpful to serve you with a better solution.
For more reference, please refer the below documentation link.
http://help.syncfusion.com/wpf/sfchart/databinding
Regards,
Samuel
Thanks for the update.
Chart renders based on IEnumerable/Datatable type which bound in the ItemsSource property in chart series. Currently there is no provision to render chart based on properties alone. Please provide more information on your requirement with the data visualization in chart, probably a pictorial representation which will be helpful to serve you with a better solution.
For more reference, please refer the below documentation link.
http://help.syncfusion.com/wpf/sfchart/databinding
Regards,
Samuel
SIGN IN To post a reply.
- 3 Replies
- 2 Participants
-
MT Mohamed Tahoun
- Apr 28, 2016 02:34 PM UTC
- May 4, 2016 03:06 PM UTC