We use cookies to give you the best experience on our website. If you continue to browse, then you agree to our privacy policy and cookie policy. Image for the cookie policy date

Populate SfChart SplineSeries to a SQLite DataSource

I'm trying to connect a SQLite database through an ObservableCollection to a populate a Spline Graph

I can build the graph from a collection hard coded in the class, and can pull the data from SQLite into a Listview.  I'm missing something in how to join the two.

Do you have a working example of this so I can see where my code is incorrect?


7 Replies

DD Devakumar Dhanapoosanam Syncfusion Team January 22, 2020 12:59 AM UTC

Hi Rob, 
Greetings from Syncfusion. 
We have analyzed your requirement using the SQLite database and prepared a sample for your requirement. 
Please let us know if you need any further assistance. 
Devakumar D 

RO Rob January 22, 2020 10:38 PM UTC

That was very helpful.  It helped show me what I was doing wrong.

Many thanks

HM Hemalatha Marikumar Syncfusion Team January 23, 2020 06:00 AM UTC

Hi Rob, 
Thanks for your update. 
We are glad to hear that given solution works.  
Please let us know if you need any further assistance. 
Hemalatha M. 

JK Joseph Kim April 26, 2021 09:18 PM UTC

Do you have codes for flutter?
I want to add, update and delete by Sqlite.
Thank you.

DP Dharanitharan Palanisamy Syncfusion Team April 27, 2021 07:58 PM UTC

Hi Joseph, 
We have prepared a sample for populating data points in Flutter Spline charts, which you can download here. Using the SQLite database, we prepared a sample for adding, reading, updating, and deleting data from the table and the same is modified in the chart. Please use this sample as a guideline and modify it to suit your needs. You can consult the support document for more details.  
Please contact us if you need any additional assistance. 
Dharanitharan. P 

JK Joseph Kim May 6, 2021 06:16 PM UTC

Thank you for your sample.
I'm trying to use X axis with date (mm-dd-yyyy) and sorting. But SQlite doesn't support date and use text format.
How can I sort automatically based on date?
Thank you.

DP Dharanitharan Palanisamy Syncfusion Team May 8, 2021 06:39 AM UTC

Hi Joseph, 
We reviewed your query and recommended that you use the int type in SQLite to store DateTime in milliseconds because SQLite does not support DateTime. You can bind the Cartesianchart with DateTimeAxis, and it is sorted by default, so you don't have to sort it manually. You can sort the CategoryAxis using SortFieldValueMapper, and you can refer to the help documentation below for more information. We have attached a sample that uses SQLite's int type to store DateTime in milliseconds and binds to the Cartesianchart. 
Dharanitharan. P 

Live Chat Icon For mobile
Up arrow icon