SQLite and dynamic google barchart

14 views
Skip to first unread message

Rasmus Johansen

unread,
Sep 19, 2017, 3:40:00 PM9/19/17
to Google Visualization API
Hi all.

I have been searching around for several weeks now, and I have not been able to figure out how to solve my problem. I hope someone here can help me selecting the easiest way of creating dynamic chart with data from my sqlite database.

As I can see it there is a lot of possibilities, but I cannot get things changed to work with my setup. And I do not know if I should select Json,ajax ,PHP or whatever else I have been reading about :-) You might have guessed already that im a noob in this.

Heres my setup:

Hardware:
Raspberry Pi 3 with raspbian noobs and connected sensor.

Webserver: nginx
Webserver location: /var/www/html/index.nginx-debian.html
Webserver local IP: 192.168.175.100

Database: Sqlite (no users and passwords)
Database location: /home/pi/furnace_data.db
Table: furnace
Table creation: sqlite> create table furnace(Timestamp DATETIME DEFAULT CURRENT_TIMESTAMP, Seconds INTEGER);
(note:this is not giving me the timestamp in my local timezone, but I will have to fix that afterwards)

Data is continuously added to the database with a pythonscript. 

Datasample:
2017-09-19 12:45:13|60
2017-09-19 12:46:13|60
2017-09-19 12:47:13|20
2017-09-19 15:55:25|60
2017-09-19 15:56:25|60
2017-09-19 15:57:25|60
2017-09-19 15:58:25|5
2017-09-19 18:44:36|54
2017-09-19 18:45:36|60
2017-09-19 18:46:36|60
2017-09-19 18:47:36|15
The timestamp is what I would like on the X-axis (maybe without seconds value) and the values after the separator is my y-values in a bar chart. Then I would like the data from the last 8 hours to be in the chart all the time.

I hope this is the info needed for someone to help me continue with my project.

Im hoping for a dynamic chart similar to whats on the attached picture. 

BR Rasmus

sample chart.png
Reply all
Reply to author
Forward
0 new messages