Usability of ui-text vs ui-chart

I think there has been some prior discussion of this topic, is the current situation set in stone?

The DB2 ui-chart has config fields for x and y series.


This makes it very easy to specify a chart from stored data eg an SQL query
select day, finalWh from mytable

Much much better than DB1 ui-chart!

In contrast, DB2's ui-text does not have a value config field, it can only display msg.payload.
So we often need a change node to move some other property into msg.payload.

I know that DB1's processing of the value field uses the mustache syntax from Angular which is not available for DB2 but just being able to select which property to display would make it much easier.

Note: my hint of an SQL query as the source of the data is deliberate. I can (probably) tweek the query so that a field value of 49.55572 is returned as "49.56 kWh"
But it will be returned as an array.
The text field cannot display msg.payload[0] unaided.

:heart:

@Steve-Mcl has done some great work on this and has a PR open - it's a beast, and I need to spend some good time digesting it, but it's an area that will hopefully improve in the very near future

2 Likes

Wouldn't like you to think I can only do negative Joe :stuck_out_tongue_winking_eye:

:+1:

1 Like

Isnt the key property inconsistent to the rest of node-red that uses msg. instead ?

just different. FYI, the typedInput can have have custom types - which is what this node is doing)

It is related the chart lib used by the node.

for example, if your data comes straight from a database and looks like this:

[
  { id: 1, "value1": 12 , "value2": 22 },
  { id: 1, "value1": 51 , "value2": 33},
]

then strictly speaking, the keys are value1 and value2 not msg.payload.value1

If however you were sending a payload of { id: 1, "value1": 12 , "value2": 22 } then you can use msg.payload.value1 or a key of value1

TLDR
It greatly simplifies DB queries

1 Like

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