Real-Time Line Series from Sensor Data

In my UWP app, I'm trying to make a chart that displays a time series of incoming values. I can accomplish this in a bar chart, and the chart responds to changes in sensor data. However, I need to visualize the time series from when the sensors are turned on. I'd like to do this as a line series with the timestamp along the X axis and the sensor values along the Y axis. How can I accomplish this?

1 Reply

SR Samuel Rajadurai Edwin Rajamanickam Syncfusion Team June 25, 2018 01:19 PM UTC

Hi Ben, 
  
We have analyzed your requirement and prepared the required solution. We have also prepared a worked sample of your requirement. 
  
We can achieve this requirement using FastLineSeries. For plotting timestamp values in x axis you can use TimeSpanAxis. You can also toggle the visibility of this series using IsSeriesVisible property of ChartSeries
  
Please refer the following user guide documentation to learn how to configure the fast line series. 
  
  
Code Snippet 
  
XAML 

        <chart:SfChart> 
                     
            <chart:SfChart.PrimaryAxis> 
                <chart:TimeSpanAxis /> 
            </chart:SfChart.PrimaryAxis> 
 
            <chart:SfChart.SecondaryAxis> 
                <chart:NumericalAxis  /> 
            </chart:SfChart.SecondaryAxis> 
 
            <chart:FastLineSeries XBindingPath="XValue"  
                                  YBindingPath="YValue"  
                                  ItemsSource="{Binding Data}"                                                     
                                  x:Name="RealTimeSeries"> 
            </chart:FastLineSeries> 
 
        </chart:SfChart> 
 

C# 

    public sealed partial class MainPage : Page 
    { 
        private void OnButton_Click(object sender, RoutedEventArgs e) 
        { 
            RealTimeSeries.IsSeriesVisible = true; 
        } 
 
        private void OffButton_Click(object sender, RoutedEventArgs e) 
        { 
            RealTimeSeries.IsSeriesVisible = false; 
        } 
    } 
 


Regards,
Samuel 


Loader.
Up arrow icon