This is a migrated thread and some comments may be shown as answers.

Lineseries and Update real time data

6 Answers 255 Views
Chart
This is a migrated thread and some comments may be shown as answers.
This question is locked. New answers and comments are not allowed.
sand
Top achievements
Rank 1
sand asked on 05 Oct 2015, 03:25 AM

 

 

 Hi

 

 

I would like create real time update data every 1 minute
i wanna see example

 

please help

Sand

 

6 Answers, 1 is accepted

Sort by
0
Pavel R. Pavlov
Telerik team
answered on 07 Oct 2015, 06:18 AM
Hi Sand,

Based on these details we cannot provide you with specific implementation. Basically creating real time data involves working with the native DateTime class.
Furthermore, it is up to your needs to decide how exactly that class should be used in your particular application.

The only example that I think is reasonable assumes that you need to create the data every first minute with start time this particular moment. For this scenario a counter/timer can be used.

Windows.UI.Xaml.DispatcherTimer timer;
void CreateTimer()
{
    timer = new Windows.UI.Xaml.DispatcherTimer();
    timer.Interval = TimeSpan.FromMinutes(1);
    timer.Tick += timer_Tick;
    timer.Start();
}
 
void timer_Tick(object sender, object e)
{
    //this will be called every 1 minute
    //you should create your data here
    //using DateTime.Now you will be able to track the time
 
    //when your data is created timer.Stop() should be called
}

I hope this information is helpful.

Regards,
Pavel R. Pavlov
Telerik
Do you want to have your say when we set our development plans? Do you want to know when a feature you care about is added or when a bug fixed? Explore the Telerik Feedback Portal and vote to affect the priority of the items
0
sand
Top achievements
Rank 1
answered on 07 Oct 2015, 08:33 AM

thanks Pavel R. Pavlov
in date time class i have code lineseries it not  to add realtime data  . how to add data real time chart   

 

my code in timer tick :  chart is refresh lineseries but no add data 

 

 

private void _timer_Tick3(object sender, object e)
        {​

List<Data> data1 = new List<Data>();
            data1.Add(new Data() { Value = this.Temperature }); // or random data
            data1.Add(new Data() { Value = this.Temperature });

            List<Data> data2 = new List<Data>();
            data2.Add(new Data() { Value1 = this.Humidity });
            data2.Add(new Data() { Value1 = this.Humidity });

            this.lineSeries.Series[0].DataContext = data1;
            this.lineSeries.Series[1].DataContext = data2;
          
 }

 

​

0
Pavel R. Pavlov
Telerik team
answered on 09 Oct 2015, 07:55 AM
Hi Sand,

I have hard time understanding what your requirements are. Initially I thought you need to create business data where one of the fields is of type DateTime and you need to create new data record every second. I do not understand what you have in mind when you say: "chart is refresh lineseries but no add data ". Note that the charting component has nothing in common with the timer tick event you sent.
Moreover you actually create new list each tick of the timer. Is that what you really need? In case you want to preserve any number of points as history of the graph you need to only add points into the series - do not create new List<Data> every second.

And still I have the feeling that I do not fully understand your scenario. I need you to provide me with clear and detailed requirements in order to ensure that we are walking in the right direction.

P.S.: I would like to turn your attention to the fact that the Temperature and Humidity parameters in the most common sense are not expected to change every second. If the fields of the provided code hold real sensor readings maybe the reason behind not updating the chart is the dynamic of those parameters.

Regards,
Pavel R. Pavlov
Telerik
Do you want to have your say when we set our development plans? Do you want to know when a feature you care about is added or when a bug fixed? Explore the Telerik Feedback Portal and vote to affect the priority of the items
0
sand
Top achievements
Rank 1
answered on 12 Oct 2015, 09:48 AM
thank you very much Pavel R. Pavlov.

this is an example  http://www.flotcharts.org/flot/examples/realtime/index.html


sorry.
I explain the poor.
0
Pavel R. Pavlov
Telerik team
answered on 13 Oct 2015, 07:11 AM
Hello Sand,

The example was helpful. I understand what you need to achieve. For your convenience I created a sample project which can be used as foundations of your application. Please note that all the updating logic is in the custom logic in the ViewModel.

I hope this is helpful.

Regards,
Pavel R. Pavlov
Telerik
Do you want to have your say when we set our development plans? Do you want to know when a feature you care about is added or when a bug fixed? Explore the Telerik Feedback Portal and vote to affect the priority of the items
0
Gustavo
Top achievements
Rank 1
answered on 06 Feb 2017, 11:40 AM
Thank you so much, pavlov. It helps me a lot 
Tags
Chart
Asked by
sand
Top achievements
Rank 1
Answers by
Pavel R. Pavlov
Telerik team
sand
Top achievements
Rank 1
Gustavo
Top achievements
Rank 1
Share this question
or