# Displaying points on chart from sqlite db

**URL:** <https://discourse.nodered.org/t/displaying-points-on-chart-from-sqlite-db/101364>\
**Category:** Dashboard\
**Tags:** dashboard-2\
**Created:** [26 June 2026 18:01 UTC](https://discourse.nodered.org/t/displaying-points-on-chart-from-sqlite-db/101364 "2026-06-26T18:01:31Z")\
**Posts on this page:** 13\
**Page:** 1

<div class="post-metadata">

**Author:** ![deedee](https://avatars.discourse-cdn.com/v4/letter/d/67e7ee/32.png) [@deedee](https://discourse.nodered.org/u/deedee)\
**Post date:** [26 June 2026 18:01 UTC](https://discourse.nodered.org/t/displaying-points-on-chart-from-sqlite-db/101364/1 "2026-06-26T18:01:31Z")

</div>

i have two columns unixtime in secs and temp ex 27.1 I read from a local database

I can see the data coming out of my convert function using debug  
but i cant seem to have it display data from my sqlite3 database on the chart ( it has a 1440 records over 1 day last week every minute)

Only an empty graph is shown with time labels that correspend to the current timeframe not from what is in the database.

My system node-red 5.0.0 , dashboard2 last version

 ![debug](https://us1.discourse-cdn.com/flex026/uploads/nodered/original/3X/1/5/15624d97a13759cf8499d71134589326fc079bbd.png)

convert function :

```auto
[
    {
        "id": "c895817421a5b54b",
        "type": "function",
        "z": "4dfc04530322666a",
        "name": "Convert data",
        "func": "let rows = msg.payload.rows || msg.payload;\n\nmsg.payload = [{\n series: \"Temp\",\n data: rows.map(r => ({\n x: r.unixtime * 1000,\n y: r.temp\n }))\n}];\n\nreturn msg;",
        "outputs": 1,
        "timeout": 0,
        "noerr": 0,
        "initialize": "",
        "finalize": "",
        "libs": [],
        "x": 670,
        "y": 220,
        "wires": [
            [
                "9a1f1aaae992eeca",
                "986640c8307a06ba"
            ]
        ]
    }
]

```

Below is the chart settings

```auto
[
    {
        "id": "9a1f1aaae992eeca",
        "type": "ui-chart",
        "z": "4dfc04530322666a",
        "group": "536adf9f94746080",
        "name": "",
        "label": "chart",
        "order": 1,
        "chartType": "line",
        "category": "topic",
        "categoryType": "msg",
        "xAxisLabel": "",
        "xAxisProperty": "payload.x",
        "xAxisPropertyType": "msg",
        "xAxisType": "linear",
        "xAxisFormat": "",
        "xAxisFormatType": "auto",
        "xmin": "",
        "xmax": "",
        "yAxisLabel": "",
        "yAxisProperty": "payload",
        "yAxisPropertyType": "msg",
        "ymin": "",
        "ymax": "",
        "bins": 10,
        "action": "append",
        "stackSeries": false,
        "pointShape": "circle",
        "pointRadius": 4,
        "showLegend": true,
        "removeOlder": "3",
        "removeOlderUnit": "86400",
        "removeOlderPoints": "",
        "colors": [
            "#0095ff",
            "#ff0000",
            "#ff7f0e",
            "#2ca02c",
            "#a347e1",
            "#d62728",
            "#ff9896",
            "#9467bd",
            "#c5b0d5"
        ],
        "textColor": [
            "#666666"
        ],
        "textColorDefault": true,
        "gridColor": [
            "#e5e5e5"
        ],
        "gridColorDefault": true,
        "width": 6,
        "height": 8,
        "className": "",
        "interpolation": "linear",
        "x": 850,
        "y": 220,
        "wires": [
            []
        ]
    },
    {
        "id": "536adf9f94746080",
        "type": "ui-group",
        "name": "Group 3",
        "page": "5f90f84eb3be396c",
        "width": 6,
        "height": 1,
        "order": 1,
        "showTitle": true,
        "className": "",
        "visible": "true",
        "disabled": "false",
        "groupType": "default"
    },
    {
        "id": "5f90f84eb3be396c",
        "type": "ui-page",
        "name": "Page 1",
        "ui": "95d4fa827ab4b0d4",
        "path": "/page1",
        "icon": "home",
        "layout": "grid",
        "theme": "1e378db9f1ad6c68",
        "breakpoints": [
            {
                "name": "Default",
                "px": "0",
                "cols": "3"
            },
            {
                "name": "Tablet",
                "px": "576",
                "cols": "6"
            },
            {
                "name": "Small Desktop",
                "px": "768",
                "cols": "9"
            },
            {
                "name": "Desktop",
                "px": "1024",
                "cols": "12"
            }
        ],
        "order": 1,
        "className": "",
        "visible": "true",
        "disabled": "false"
    },
    {
        "id": "95d4fa827ab4b0d4",
        "type": "ui-base",
        "name": "My Dashboard",
        "path": "/dashboard",
        "appIcon": "",
        "includeClientData": true,
        "acceptsClientConfig": [
            "ui-notification",
            "ui-control"
        ],
        "showPathInSidebar": false,
        "headerContent": "page",
        "navigationStyle": "default",
        "titleBarStyle": "default",
        "showReconnectNotification": true,
        "notificationDisplayTime": 1,
        "showDisconnectNotification": true,
        "allowInstall": false
    },
    {
        "id": "1e378db9f1ad6c68",
        "type": "ui-theme",
        "name": "Default Theme",
        "colors": {
            "surface": "#ffffff",
            "primary": "#0094CE",
            "bgPage": "#eeeeee",
            "groupBg": "#ffffff",
            "groupOutline": "#cccccc"
        },
        "sizes": {
            "density": "default",
            "pagePadding": "12px",
            "groupGap": "12px",
            "groupBorderRadius": "4px",
            "widgetGap": "12px"
        }
    },
    {
        "id": "abf878b67b930988",
        "type": "global-config",
        "env": [],
        "modules": {
            "@flowfuse/node-red-dashboard": "1.30.2"
        }
    }
]

```

---

<div class="post-metadata">

**Author:** ![jbudd](https://avatars.discourse-cdn.com/v4/letter/j/5f8ce5/32.png) [@jbudd](https://discourse.nodered.org/u/jbudd)\
**Post date:** [26 June 2026 19:48 UTC](https://discourse.nodered.org/t/displaying-points-on-chart-from-sqlite-db/101364/2 "2026-06-26T19:48:30Z")

</div>

Welcome to the forum @deedee

> [@deedee](#):
>
> I can see the data coming out of my convert function using debug

It would be helpful if we could see the data too. A picture of your flow isn't much use.

You can copy the value shown in your debug output with the buttons which appear when you hover over the data.  
Post it here using the `</>` button so that we can copy and import the data.

Also please highlight just your chart node and export it (CTRL - e), then paste it here, again using the `</>` button.

---

<div class="post-metadata">

**Author:** ![deedee](https://avatars.discourse-cdn.com/v4/letter/d/67e7ee/32.png) [@deedee](https://discourse.nodered.org/u/deedee)\
**Post date:** [26 June 2026 20:11 UTC](https://discourse.nodered.org/t/displaying-points-on-chart-from-sqlite-db/101364/3 "2026-06-26T20:11:06Z")

</div>

Thank you , i have added the debug and chart config in my topic

---

<div class="post-metadata">

**Author:** ![jbudd](https://avatars.discourse-cdn.com/v4/letter/j/5f8ce5/32.png) [@jbudd](https://discourse.nodered.org/u/jbudd)\
**Post date:** [26 June 2026 20:25 UTC](https://discourse.nodered.org/t/displaying-points-on-chart-from-sqlite-db/101364/4 "2026-06-26T20:25:22Z")

</div>

You do not need to convert database output to x and y values for Dashboard 2.

You have not posted any data, just a picture of it (after your function has manipulated it?) so I can't be sure, but something like this might work.

 ![image](https://us1.discourse-cdn.com/flex026/uploads/nodered/original/3X/5/d/5d6f0813cf7857b4d3fd96cd93d75f67fc5bcd75.png)

---

<div class="post-metadata">

**Author:** ![deedee](https://avatars.discourse-cdn.com/v4/letter/d/67e7ee/32.png) [@deedee](https://discourse.nodered.org/u/deedee)\
**Post date:** [26 June 2026 20:51 UTC](https://discourse.nodered.org/t/displaying-points-on-chart-from-sqlite-db/101364/5 "2026-06-26T20:51:48Z")

</div>

Below is a json export of my sqlite table.  
The timestamps have an interval of 1 minute / 1440 records in total

```auto
[
  {
    "_explicit_rowid_": 1,
    "unixtime": 1782384513,
    "temp": 17.71
  },
  {
    "_explicit_rowid_": 2,
    "unixtime": 1782384573,
    "temp": 17.82
  },
  {
    "_explicit_rowid_": 3,
    "unixtime": 1782384633,
    "temp": 18.06
  },
  {
    "_explicit_rowid_": 4,
    "unixtime": 1782384693,
    "temp": 18.25
  },
  {
    "_explicit_rowid_": 5,
    "unixtime": 1782384753,
    "temp": 17.84
  },
  {
    "_explicit_rowid_": 6,
    "unixtime": 1782384813,
    "temp": 18.11
  },
  {
    "_explicit_rowid_": 7,
    "unixtime": 1782384873,
    "temp": 18.09
  },
  {
    "_explicit_rowid_": 8,
    "unixtime": 1782384933,
    "temp": 18.1
  },
  {
    "_explicit_rowid_": 9,
    "unixtime": 1782384993,
    "temp": 17.99
  },
  {
    "_explicit_rowid_": 10,
    "unixtime": 1782385053,
    "temp": 17.77
  },

```

---

<div class="post-metadata">

**Author:** ![jbudd](https://avatars.discourse-cdn.com/v4/letter/j/5f8ce5/32.png) [@jbudd](https://discourse.nodered.org/u/jbudd)\
**Post date:** [27 June 2026 00:10 UTC](https://discourse.nodered.org/t/displaying-points-on-chart-from-sqlite-db/101364/6 "2026-06-27T00:10:24Z")

</div>

You can get a chart showing your data by setting x axis type Categorical, x key unixtime and y key temp:

 ![image](https://us1.discourse-cdn.com/flex026/uploads/nodered/original/3X/7/5/7592bb63d8773eeee8eff7cd594b33790427e9e3.png)

But I doubt if a timestamp eg `1782384513` is what you really want to see on the x axis.

It makes more sense to tweek your SQL query to return a formatted date/time, something like this. Obviously adjust for your table name and columns, and check the parameters for datetime()

```auto
select id, datetime(unixtime, 'unixepoch') as dt, temp from temperature_readings

```

Then this chart node

 ![image](https://us1.discourse-cdn.com/flex026/uploads/nodered/original/3X/a/e/aee01926d118e1b4e4e00f7832daae1f1e8eff22.png)  
gives me this on the dashboard  
 ![image](https://us1.discourse-cdn.com/flex026/uploads/nodered/original/3X/d/c/dcf2c9863e3879267d3d85ef428831280d7a501c.png)

---

<div class="post-metadata">

**Author:** ![deedee](https://avatars.discourse-cdn.com/v4/letter/d/67e7ee/32.png) [@deedee](https://discourse.nodered.org/u/deedee)\
**Post date:** [27 June 2026 08:42 UTC](https://discourse.nodered.org/t/displaying-points-on-chart-from-sqlite-db/101364/7 "2026-06-27T08:42:12Z")

</div>

It still doesnt work for me , let me summarize my current config

- sqlite node =\> fixed SQL  
`select datetime(unixtime, 'unixepoch') as dt, temp from readings`
- chart config  
 ![chartnode](https://us1.discourse-cdn.com/flex026/uploads/nodered/original/3X/f/5/f5bb5b7beb076586754d327e74bb3e52abf6cd0d.png)
- Dashboard graph shows emptry graph with y axis labeled from 10-40 / x axis labels empty and no datapoints

---

<div class="post-metadata">

**Author:** ![jbudd](https://avatars.discourse-cdn.com/v4/letter/j/5f8ce5/32.png) [@jbudd](https://discourse.nodered.org/u/jbudd)\
**Post date:** [27 June 2026 08:49 UTC](https://discourse.nodered.org/t/displaying-points-on-chart-from-sqlite-db/101364/8 "2026-06-27T08:49:06Z")

</div>

The word "key" against x and y in the chart config refer to the key:value pairs in the array of objects from the database.

Your timestamp key is "dt" not "unixtime"  
(Because of the AS clause in `select datetime(unixtime, 'unixepoch') AS dt`)

---

<div class="post-metadata">

**Author:** ![deedee](https://avatars.discourse-cdn.com/v4/letter/d/67e7ee/32.png) [@deedee](https://discourse.nodered.org/u/deedee)\
**Post date:** [27 June 2026 10:37 UTC](https://discourse.nodered.org/t/displaying-points-on-chart-from-sqlite-db/101364/9 "2026-06-27T10:37:03Z")

</div>

Thank you for your help, it works finally, it felt like a struggle , i asked chatgpt for help but that was a waste of time.

I noticed that all the 1440 points now show in the graph , is that a feature of the chart node that it tries to fit all the points on the graph without a scroll bar?

---

<div class="post-metadata">

**Author:** ![TotallyInformation](https://sea2.discourse-cdn.com/flex026/user_avatar/discourse.nodered.org/totallyinformation/32/31_2.png) [@TotallyInformation](https://discourse.nodered.org/u/TotallyInformation)\
**Post date:** [27 June 2026 11:39 UTC](https://discourse.nodered.org/t/displaying-points-on-chart-from-sqlite-db/101364/10 "2026-06-27T11:39:03Z")

</div>

> [@jbudd](#):
>
> But I doubt if a timestamp eg `1782384513` is what you really want to see on the x axis.

You could also convert the seconds value into ms which echarts also seems to allow. At least from my recent experience starting to build some timeseries chart components.

---

<div class="post-metadata">

**Author:** ![jbudd](https://avatars.discourse-cdn.com/v4/letter/j/5f8ce5/32.png) [@jbudd](https://discourse.nodered.org/u/jbudd)\
**Post date:** [27 June 2026 11:49 UTC](https://discourse.nodered.org/t/displaying-points-on-chart-from-sqlite-db/101364/11 "2026-06-27T11:49:07Z")

</div>

Good suggestion.  
It just has to be a format which the js library recognises as date/time, not necessarily a string.

So that would be select unixtime \* 1000, ... which @deedee originally had, though in a function node rather than the select statement.

---

<div class="post-metadata">

**Author:** ![deedee](https://avatars.discourse-cdn.com/v4/letter/d/67e7ee/32.png) [@deedee](https://discourse.nodered.org/u/deedee)\
**Post date:** [27 June 2026 11:58 UTC](https://discourse.nodered.org/t/displaying-points-on-chart-from-sqlite-db/101364/12 "2026-06-27T11:58:26Z")

</div>

> [@jbudd](#):
>
> unixtime \* 1000

Yes i had that originally but i couldnt get it to work

---

<div class="post-metadata">

**Author:** ![system](https://us1.discourse-cdn.com/flex026/uploads/nodered/original/1X/d073cd938eafa2e558d7c2cd59003b3ef4963033.png) [@system](https://discourse.nodered.org/u/system)\
**Post date:** [11 July 2026 11:58 UTC](https://discourse.nodered.org/t/displaying-points-on-chart-from-sqlite-db/101364/13 "2026-07-11T11:58:45Z")

</div>

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