Lineseries and Update real time data

6 posts, 0 answers
  1. sand
    sand avatar
    3 posts
    Member since:
    Sep 2015

    Posted 04 Oct 2015 Link to this post

     

     

     Hi

     

     

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

     

    please help

    Sand

     

  2. Pavel R. Pavlov
    Admin
    Pavel R. Pavlov avatar
    1182 posts

    Posted 07 Oct 2015 Link to this post

    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
  3. sand
    sand avatar
    3 posts
    Member since:
    Sep 2015

    Posted 07 Oct 2015 in reply to Pavel R. Pavlov Link to this post

    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;
              
     }

     

  4. Pavel R. Pavlov
    Admin
    Pavel R. Pavlov avatar
    1182 posts

    Posted 09 Oct 2015 Link to this post

    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
  5. sand
    sand avatar
    3 posts
    Member since:
    Sep 2015

    Posted 12 Oct 2015 Link to this post

    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.
  6. Pavel R. Pavlov
    Admin
    Pavel R. Pavlov avatar
    1182 posts

    Posted 13 Oct 2015 Link to this post

    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
Back to Top