Using graphs with SQL Logger Plugin

Posted on
Mon May 30, 2016 11:36 am
davinci offline

Using graphs with SQL Logger Plugin

I want to get data from the Sqlite database, process the last 7 days (or 24h) of a sensor and put the values in a nice graph on a website. The data will be read locally by PHP.

I think Charts v3 might be a valid platform to show the data:
https://www.amcharts.com/demos/date-based-data/

Something like this works but it seems to be lot of work to program for every value of every sensor...

Code: Select all
<?php
    $db = new SQLite3('test.sqlite');
    $db->busyTimeout(5000);
   
    $kitchen= ($db->querySingle('SELECT value FROM variable_history_4923453425 ORDER BY id DESC LIMIT 1'));
    $sleep = ($db->querySingle('SELECT value FROM variable_history_1564776538 ORDER BY id DESC LIMIT 1'));
   
    echo '
    var chartData = [
{
"raum": "sleep",
"temperatur": ' . $sleep . ',
"color": "#B0DE09"
},
{
"raum": "kitchen",
"temperatur": ' . $kitchen . ',
"color": "#BF3EFF"
}];
    ';
    $db->close();
    unset($db);

    ?>


Is there anything done already where I can build upon?
Or are there other ideas?

Posted on
Tue May 31, 2016 5:52 am
matt (support) offline
Site Admin
User avatar
Posts: 21411
Joined: Jan 27, 2003
Location: Texas

Re: Using graphs with SQL Logger Plugin

It isn't PHP based (rather, an Indigo plugin), but have you tried Karl's INDIGOplotD?

Image

Page 1 of 1

Who is online

Users browsing this forum: No registered users and 1 guest

cron