From sqlite to json format

Ok, there are a nuber of problems in that your data is not in the correct format for the chart.

issue 1: You have a number of errors in the jsonata in the change node. Use this in place of what you have:

[
   {
       "series": ["HVACHP"],
       "data": [[payload[[0..99]]]],
       "labels": [[""]]

   }

]

issue 2: the format of the data sent into the chart node must use 'x' and 'y' so you have to change the SQL query to return 'x' inplace of 'UTC' and 'y' inplace of 'hp' - change the query in the function node to:

var b= " SELECT UTC as 'x', hp as 'y'  FROM hvac4 WHERE UTC BETWEEN "+ stday2 +" AND "+ enday2+" " 

issue 3: change the flow so the change node is connected to the sql node and the change nodt feeds the chart node directly.

See how that works.

@Colin

Hi Colin

I been searching a lot on internet to create this type of db.
I saw many examples to format sqlite db in that way.
What I'm trying to do is shown on chart some parameter over the time and
the real time parameters are been watching on a dashboard which I've already working.

I'm not software engineer, I'm still learning about JS that the reason I choose Node-red.
So if you have a better alternative to manage db for historical purpose is gonna be very much
appreciated
In the mean time I gonna go on with Paul who is helping me a lot.
He really make me struggle with this stuff and I appreciate it because is the best way to learn .
Kind Regards,
Alex

@zenofmud
Thank you for your time.
I will give try to your suggestion.
Kind regard,
Alex

If you want to look at historical data, zoom in and out and so on then many suggest that using Influxdb with Grafana is a good way to go. With Grafana you will get much better graphical capabilities than you will get trying to do it yourself with the node red dashboard chart, which is designed as a quick and easy way to real time charts. There are influxdb nodes in node-red for easily writing the data to the database, then you use Grafana for viewing them.

@zenofmud

Yes, Sir !

With your last suggestion the chart is now working !!!
I'm gonna analyze the changes to comprehend them.
I don't like using something without understanding it and repeating it as a parrot. :smile:
Than you very much for your time

@spyder0552

Hi
Take a look at the last Paul's post.

I already have the chart working !!!

Thank you for your help, also !!!

This topic was automatically closed 14 days after the last reply. New replies are no longer allowed.