sfChart Firebase Realtime Database live update

I would like to display data from a firebase db in sfChart, updating as data is added to the records, something like this...
I've successfully added this data to a ListView control so I'm happy that I'm receiving new data with... (copypasting has mangled the formatting but you get the idea)
protected override async void OnAppearing()
{
base.OnAppearing();
Connectivity.ConnectivityChanged+=Connectivity_ConnectivityChanged;
 
firebase=new FirebaseClient("https://....firebaseio.com/");
 
var observable=firebase
.Child("temperatures")
.AsObservable<TemperatureReading>();
ListReadings.ItemsSource=observable
.AsObservableCollection();
}
However, with sfChart I cannot get data to display. Here's what I have:
XAML:
<xForms:SfChart.Series>
  <xForms:SplineSeriesx:Name="SplineDataSeries"
SplineType="Natural"
StrokeWidth="1"
XBindingPath="date"
YBindingPath="temperature"
/>
xForms:SfChart.Series>

c#
protected override void OnAppearing()
{
base.OnAppearing();
 
firebase=new FirebaseClient("https://....firebaseio.com/");
 
var observable=firebase.Child("temperatures")
.AsObservable<TemperatureReading>();
 
  SplineDataSeries.ItemsSource=observable.AsObservableCollection();
}
Result:
Would appreciate your advice how to display realtime data from firebase.

3 Replies 1 reply marked as answer

DD Devakumar Dhanapoosanam Syncfusion Team July 9, 2020 12:03 PM UTC

 
Greetings from Syncfusion. 
 
We have analyzed your query and provided details and we would like to let you know that the chart will render properly if the series ItemsSource and set XBindingPath and YBindingPath property value. We have analyzed your code and XBindingPath, YBindingPath value was set proper based on firebase data model parameter used.  
 
Can you please ensure us the following details at your end and share the following details which will be helpful for us to analyze at our end? 
·       Please share the Chart PrimaryAxis and SecondaryAxis details? Incase the PrimaryAxis is DateTimeAxis please ensure the firebase TemperatureReading “date” property type is of DateTime or not. 
  
·       Please check and ensure us the BindingContext set for the chart using the firebase database ViewModel temperatures data. 
·       Can you please ensure us the spline series ItemsSource set using the firebase consists of data and if possible, can you please share the data values? 
SplineDataSeries.ItemsSource=observable.AsObservableCollection(); 
·       Please also ensure whether the collection has model properties like “date” and “temperature” 
 
Please refer the below help document for more details 
 
Regards, 
Devakumar D 


Marked as answer

EG Eddie Green July 10, 2020 03:45 AM UTC

Thanks for getting back to me on this.

I'm sure I've done something wrong, sure even something as basic as your checklist...

Please see project attached which picks up live working data. The date is just a string timecode at the moment, sure that doesn't matter but let me know if the X axis has a problem with a string value and I'll change it to something you can work with.

Thanks, Eddie

Attachment: FirebaseDemo_21794a59.zip


DD Devakumar Dhanapoosanam Syncfusion Team July 13, 2020 06:18 PM UTC

Hi Eddie Green, 
 
Thanks for your update. 
    
Under your account, we have created a support incident to track the status of this reported query.    
    
Please log on to our support website to check for further updates.    
    
 
Regards, 
Devakumar D 


Loader.
Up arrow icon