Hello:
I’m moving a multi-series chart from DB1 to DB2 and am having some trouble. I looked at the example that @joepavitt gave in an earlier thread (https://discourse.nodered.org/t/help-chart-multiple-series-migration-code-d1-to-d2/89328/4) but I think that assumes that the x-axis values are the same for the 3 data points (y-axis).
In my case, the x-axis value (time) could be different for each series (multiple readings at different times within a day for different sensors). I can send both data sets as independent payloads and set the “action” to replace and it works the first time I press the “update” button (that triggers the flow). But then keeps overlaying the data set every time.
Is there a way to chart series with different x-axis (time) and y-axis (lux) values by sending the data in a single payload? Or is there another workaround?
Below is an example of the data that is coming in from the database query:
And in an Inject node:
[{"id":"f8059f5e830498dc","type":"inject","z":"0316cd25d00c5e0d","name":"Sample Chart Data","props":[{"p":"payload"},{"p":"topic","vt":"str"}],"repeat":"","crontab":"","once":false,"onceDelay":0.1,"topic":"","payload":"[[{\"x\":1753877243000,\"y\":3},{\"x\":1753877663000,\"y\":5},{\"x\":1753878563000,\"y\":7},{\"x\":1753879283000,\"y\":9},{\"x\":1753879763000,\"y\":11},{\"x\":1753880003000,\"y\":13},{\"x\":1753881143000,\"y\":11},{\"x\":1753881743000,\"y\":13},{\"x\":1753881923000,\"y\":15},{\"x\":1753882643000,\"y\":17},{\"x\":1753883123000,\"y\":15},{\"x\":1753883603000,\"y\":17},{\"x\":1753883843000,\"y\":19},{\"x\":1753884083000,\"y\":21},{\"x\":1753884803000,\"y\":23},{\"x\":1753885283000,\"y\":25},{\"x\":1753885643000,\"y\":27},{\"x\":1753885943000,\"y\":29},{\"x\":1753886123000,\"y\":31},{\"x\":1753886243000,\"y\":33},{\"x\":1753886543000,\"y\":35},{\"x\":1753886663000,\"y\":37},{\"x\":1753886783000,\"y\":39},{\"x\":1753886903000,\"y\":41},{\"x\":1753887023000,\"y\":43},{\"x\":1753887443000,\"y\":45},{\"x\":1753887563000,\"y\":47},{\"x\":1753887683000,\"y\":49},{\"x\":1753887863000,\"y\":51},{\"x\":1753887983000,\"y\":53},{\"x\":1753888103000,\"y\":55},{\"x\":1753888283000,\"y\":57},{\"x\":1753888523000,\"y\":59},{\"x\":1753889603000,\"y\":61},{\"x\":1753890743000,\"y\":59},{\"x\":1753891823000,\"y\":57}],[{\"x\":1753870522000,\"y\":1.5},{\"x\":1753875443000,\"y\":3},{\"x\":1753875503000,\"y\":2},{\"x\":1753876103000,\"y\":3},{\"x\":1753877183000,\"y\":4},{\"x\":1753877483000,\"y\":5},{\"x\":1753877843000,\"y\":6},{\"x\":1753878203000,\"y\":7},{\"x\":1753878683000,\"y\":8},{\"x\":1753879103000,\"y\":8.67},{\"x\":1753879343000,\"y\":10},{\"x\":1753879703000,\"y\":11},{\"x\":1753880003000,\"y\":12},{\"x\":1753880423000,\"y\":11},{\"x\":1753880843000,\"y\":13},{\"x\":1753881323000,\"y\":15},{\"x\":1753882583000,\"y\":17},{\"x\":1753883903000,\"y\":19},{\"x\":1753885343000,\"y\":21},{\"x\":1753886423000,\"y\":23},{\"x\":1753886723000,\"y\":26},{\"x\":1753886783000,\"y\":23},{\"x\":1753887143000,\"y\":25},{\"x\":1753887443000,\"y\":23},{\"x\":1753888223000,\"y\":25},{\"x\":1753889243000,\"y\":27},{\"x\":1753890803000,\"y\":28.5}]]","payloadType":"json","x":138.6470489501953,"y":141.02756518652345,"wires":[[]]}]
Thanks for your help