# Problem getting DB2 chart to display data

**URL:** <https://discourse.nodered.org/t/problem-getting-db2-chart-to-display-data/98684>\
**Category:** Dashboard\
**Tags:** dashboard-2\
**Created:** [15 August 2025 18:49 UTC](https://discourse.nodered.org/t/problem-getting-db2-chart-to-display-data/98684 "2025-08-15T18:49:07Z")\
**Posts on this page:** 7\
**Page:** 1

<div class="post-metadata">

**Author:** ![k5map](https://sea2.discourse-cdn.com/flex026/user_avatar/discourse.nodered.org/k5map/32/47681_2.png) [@k5map](https://discourse.nodered.org/u/k5map)\
**Post date:** [15 August 2025 18:49 UTC](https://discourse.nodered.org/t/problem-getting-db2-chart-to-display-data/98684/1 "2025-08-15T18:49:07Z")

</div>

I am trying to display data from a sensor using the DB2 Chart widget. The data arrives every 1 minute. Because I need to convert some of the data, I have a Function widget in front of the Chart widget, so I can output data to the chart in any format required. The example input data is very simple:

“A”: 1, “B”: 2, “C”: 3, “D”: 4, “E”:5

I have attempted to send data to the chart in many different formats to have it displayed as a bar chart replacing existing data with new data. Could someone please provide me with the format required in order to get the chart to work?

---

<div class="post-metadata">

**Author:** ![marcus-j-davies](https://sea2.discourse-cdn.com/flex026/user_avatar/discourse.nodered.org/marcus-j-davies/32/103435_2.png) [@marcus-j-davies](https://discourse.nodered.org/u/marcus-j-davies)\
**Post date:** [15 August 2025 19:12 UTC](https://discourse.nodered.org/t/problem-getting-db2-chart-to-display-data/98684/2 "2025-08-15T19:12:57Z")

</div>

Hi @k5map

I don't do DB much (plenty here though that do) - but willing to take a crack at it!

can you share a minimal flow, that demos the issue?

- And maybe share an image mock up on what you want as the graph

---

<div class="post-metadata">

**Author:** ![Buckskin](https://avatars.discourse-cdn.com/v4/letter/b/b9e5f3/32.png) [@Buckskin](https://discourse.nodered.org/u/Buckskin)\
**Post date:** [15 August 2025 19:16 UTC](https://discourse.nodered.org/t/problem-getting-db2-chart-to-display-data/98684/3 "2025-08-15T19:16:14Z")

</div>

The easiest way is;  
[{x: 'A', y: 1}, {x: 'B', y: 2}, {x: 'C', y: 3}, {x: 'D', y: 4}, {x: 'E', y: 5},]

then in the chart widget set X: key to x and Y:key to y and Action to Replace

see ([Chart ui-chart | Node-RED Dashboard 2.0](https://dashboard.flowfuse.com/nodes/widgets/ui-chart)) for more information

Quick flow as demo. Note JSONata used in inject node involves bunches of `"`

```auto
[{"id":"0f6d3d8b1e5b1b4a","type":"ui-chart","z":"506727cd93754bdb","group":"2b6374aea574ed0a","name":"","label":"chart","order":9007199254740991,"chartType":"bar","category":"","categoryType":"none","xAxisLabel":"","xAxisProperty":"x","xAxisPropertyType":"property","xAxisType":"category","xAxisFormat":"","xAxisFormatType":"auto","xmin":"","xmax":"","yAxisLabel":"","yAxisProperty":"y","yAxisPropertyType":"property","ymin":"","ymax":"","bins":10,"action":"replace","stackSeries":false,"pointShape":"circle","pointRadius":4,"showLegend":true,"removeOlder":1,"removeOlderUnit":"3600","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":5640,"wires":[[]]},{"id":"9758136e0ea1dc6f","type":"inject","z":"506727cd93754bdb","name":"","props":[{"p":"payload"}],"repeat":"","crontab":"","once":false,"onceDelay":0.1,"topic":"","payload":"[{\"x\":\"A\",\"y\":1},{\"x\":\"B\",\"y\":2},{\"x\":\"C\",\"y\":3},{\"x\":\"D\",\"y\":4},{\"x\":\"E\",\"y\":5}]","payloadType":"json","x":650,"y":5640,"wires":[["0f6d3d8b1e5b1b4a"]]},{"id":"2b6374aea574ed0a","type":"ui-group","name":"Tester","page":"7294756f31e17b81","width":6,"height":1,"order":-1,"showTitle":true,"className":"","visible":"true","disabled":"false","groupType":"default"},{"id":"7294756f31e17b81","type":"ui-page","name":"Home","ui":"b810194ea14e3502","path":"/home","icon":"home","layout":"grid","theme":"5075a7d8e4947586","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":9,"className":"","visible":"true","disabled":"false"},{"id":"b810194ea14e3502","type":"ui-base","name":"Dashboard 2 Examples","path":"/dashboard","appIcon":"","includeClientData":true,"acceptsClientConfig":["ui-control","ui-notification"],"showPathInSidebar":false,"headerContent":"page","navigationStyle":"default","titleBarStyle":"default","showReconnectNotification":true,"notificationDisplayTime":5,"showDisconnectNotification":true,"allowInstall":true},{"id":"5075a7d8e4947586","type":"ui-theme","name":"Default Theme","colors":{"surface":"#ffffff","primary":"#0094ce","bgPage":"#eeeeee","groupBg":"#ffffff","groupOutline":"#cccccc"},"sizes":{"pagePadding":"12px","groupGap":"6px","groupBorderRadius":"4px","widgetGap":"12px","density":"default"}},{"id":"8dfa472da192de08","type":"global-config","env":[],"modules":{"@flowfuse/node-red-dashboard":"1.26.0"}}]

```

---

<div class="post-metadata">

**Author:** ![k5map](https://sea2.discourse-cdn.com/flex026/user_avatar/discourse.nodered.org/k5map/32/47681_2.png) [@k5map](https://discourse.nodered.org/u/k5map)\
**Post date:** [15 August 2025 19:41 UTC](https://discourse.nodered.org/t/problem-getting-db2-chart-to-display-data/98684/4 "2025-08-15T19:41:01Z")

</div>

@Buckskin … Ok I think I did as you suggested but still am unable to get anything to show. Here is my data:

> msg = [  
> {"band": "6m", "data": nos6m },  
> {"band": "10m", "data": nos10m },  
> {"band": "15m", "data": nos15m },  
> {"band": "20m", "data": nos20m },  
> {"band": "30m", "data": nos30m },  
> {"band": "40m", "data": nos40m },  
> {"band": "80m", "data": nos80m },  
> {"band": "160m", "data": nos160m }  
> ];

Here are my chart settings:

> Type: Bar, Group: Side-bySide, Action: Replace, Series: (none), X: msg.band, Y: msg.data

See anything out of place?

---

<div class="post-metadata">

**Author:** ![k5map](https://sea2.discourse-cdn.com/flex026/user_avatar/discourse.nodered.org/k5map/32/47681_2.png) [@k5map](https://discourse.nodered.org/u/k5map)\
**Post date:** [15 August 2025 19:55 UTC](https://discourse.nodered.org/t/problem-getting-db2-chart-to-display-data/98684/5 "2025-08-15T19:55:12Z")

</div>

@Buckskin … my bad… I forgot to change “msg” to “key” in the chart widget. Once I did, all is good. now. Much thanks for your assistance.

---

<div class="post-metadata">

**Author:** ![Buckskin](https://avatars.discourse-cdn.com/v4/letter/b/b9e5f3/32.png) [@Buckskin](https://discourse.nodered.org/u/Buckskin)\
**Post date:** [15 August 2025 20:12 UTC](https://discourse.nodered.org/t/problem-getting-db2-chart-to-display-data/98684/6 "2025-08-15T20:12:41Z")

</div>

> [@k5map](#):
>
> msg = [  
> {"band": "6m", "data": nos6m },  
> {"band": "10m", "data": nos10m },  
> {"band": "15m", "data": nos15m },  
> {"band": "20m", "data": nos20m },  
> {"band": "30m", "data": nos30m },  
> {"band": "40m", "data": nos40m },  
> {"band": "80m", "data": nos80m },  
> {"band": "160m", "data": nos160m }  
> ];

If you change `msg =` to `msg.payload =` you can then set `X: band` & `Y: data`

---

<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:** [29 August 2025 20:12 UTC](https://discourse.nodered.org/t/problem-getting-db2-chart-to-display-data/98684/7 "2025-08-29T20:12:48Z")

</div>

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