You do not say where your data comes form and if you parse it to that format.
Saying that db2 data can come in an array of objects, i.e a result from a db [{"timestamp":1111, "temp": 20,"device":"sensor1"},{"timestamp":1111, "temp": 20,"device":"sensor2"}]
You then set the x, y and series key in the chart to x - timestamp, y - temp, series - device.
This allows you to set multiple series using the device property, you can set these keys to any property name you wish.
It is all in the docs of course Chart ui-chart | Node-RED Dashboard 2.0
You can use msg.action to dynamically append or replace the chart data