node-red-dashboard
node-red-dashboard copied to clipboard
ui-chart: series property of JSON array of keys doesn't work for object payload
Current Behavior
In ui-chart, setting the series property to type JSON and providing an array of keys, only works if payload is an array, and fails if payload is an object.
Expected Behavior
The documentation says:
Alternatively, you can set the series property to type JSON, and then provide an array of keys (e.g. ["key1", "key2"]), which will plot a data point for each key provided, from a single data point.
When only one data poing is sent (payload is an object) it should work like when sending an array of objects.
Steps To Reproduce
Create an inject node that injects the following JSON:
[
{
"x_value": 12,
"value": 17,
"nested": {
"value": 24
}
}
]
Create an ui-chart node connected to the inject. Set the chart "Series" to JSON, with value ["value", "nested.value"]
and set "X" to key: x_value.
Display the chart and inject the value. It should display it.
Modify the injected JSON to:
{
"x_value": 12,
"value": 17,
"nested": {
"value": 24
}
}
inject the new value. The chart shows nothing.
Environment
- Environment
- Dashboard version: 1.11.1
- Node-RED version: 3.1.10
- Node.js version: v16.20.2
- npm version: 8.19.4
- Platform/OS: NodeRed on Docker (Linux 5.15.0-112-generic x64 LE)
- Browser: Chrome
Have you provided an initial effort estimate for this issue?
I can not provide an initial effort estimate