Combine two arrays into one

Hello,
Hi @E1cid :kissing_heart:

I´ve another data source, which I want to combine:
price today

[{"total":0.2828,"energy":0.1347,"tax":0.1481,"startsAt":"2023-02-23T00:00:00.000+01:00","currency":"EUR","level":"NORMAL"},{"total":0.2789,"energy":0.1314,"tax":0.1475,"startsAt":"2023-02-23T01:00:00.000+01:00","currency":"EUR","level":"NORMAL"},{"total":0.276,"energy":0.129,"tax":0.147,"startsAt":"2023-02-23T02:00:00.000+01:00","currency":"EUR","level":"NORMAL"},{"total":0.271,"energy":0.1248,"tax":0.1462,"startsAt":"2023-02-23T03:00:00.000+01:00","currency":"EUR","level":"NORMAL"},{"total":0.2715,"energy":0.1252,"tax":0.1463,"startsAt":"2023-02-23T04:00:00.000+01:00","currency":"EUR","level":"NORMAL"},{"total":0.2771,"energy":0.1299,"tax":0.1472,"startsAt":"2023-02-23T05:00:00.000+01:00","currency":"EUR","level":"NORMAL"},{"total":0.3057,"energy":0.154,"tax":0.1517,"startsAt":"2023-02-23T06:00:00.000+01:00","currency":"EUR","level":"EXPENSIVE"},{"total":0.3248,"energy":0.17,"tax":0.1548,"startsAt":"2023-02-23T07:00:00.000+01:00","currency":"EUR","level":"EXPENSIVE"},{"total":0.3344,"energy":0.1781,"tax":0.1563,"startsAt":"2023-02-23T08:00:00.000+01:00","currency":"EUR","level":"EXPENSIVE"},{"total":0.3243,"energy":0.1696,"tax":0.1547,"startsAt":"2023-02-23T09:00:00.000+01:00","currency":"EUR","level":"EXPENSIVE"},{"total":0.3065,"energy":0.1546,"tax":0.1519,"startsAt":"2023-02-23T10:00:00.000+01:00","currency":"EUR","level":"NORMAL"},{"total":0.3008,"energy":0.1498,"tax":0.151,"startsAt":"2023-02-23T11:00:00.000+01:00","currency":"EUR","level":"NORMAL"},{"total":0.2918,"energy":0.1422,"tax":0.1496,"startsAt":"2023-02-23T12:00:00.000+01:00","currency":"EUR","level":"NORMAL"},{"total":0.2852,"energy":0.1367,"tax":0.1485,"startsAt":"2023-02-23T13:00:00.000+01:00","currency":"EUR","level":"NORMAL"},{"total":0.2835,"energy":0.1353,"tax":0.1482,"startsAt":"2023-02-23T14:00:00.000+01:00","currency":"EUR","level":"NORMAL"},{"total":0.2836,"energy":0.1354,"tax":0.1482,"startsAt":"2023-02-23T15:00:00.000+01:00","currency":"EUR","level":"NORMAL"},{"total":0.2886,"energy":0.1395,"tax":0.1491,"startsAt":"2023-02-23T16:00:00.000+01:00","currency":"EUR","level":"NORMAL"},{"total":0.3038,"energy":0.1524,"tax":0.1514,"startsAt":"2023-02-23T17:00:00.000+01:00","currency":"EUR","level":"NORMAL"},{"total":0.3191,"energy":0.1652,"tax":0.1539,"startsAt":"2023-02-23T18:00:00.000+01:00","currency":"EUR","level":"NORMAL"},{"total":0.3189,"energy":0.165,"tax":0.1539,"startsAt":"2023-02-23T19:00:00.000+01:00","currency":"EUR","level":"NORMAL"},{"total":0.308,"energy":0.1559,"tax":0.1521,"startsAt":"2023-02-23T20:00:00.000+01:00","currency":"EUR","level":"NORMAL"},{"total":0.3024,"energy":0.1511,"tax":0.1513,"startsAt":"2023-02-23T21:00:00.000+01:00","currency":"EUR","level":"NORMAL"},{"total":0.2958,"energy":0.1456,"tax":0.1502,"startsAt":"2023-02-23T22:00:00.000+01:00","currency":"EUR","level":"NORMAL"},{"total":0.2789,"energy":0.1315,"tax":0.1474,"startsAt":"2023-02-23T23:00:00.000+01:00","currency":"EUR","level":"NORMAL"}]

price tomorrw:

[{"total":0.2816,"energy":0.1337,"tax":0.1479,"startsAt":"2023-02-24T00:00:00.000+01:00","currency":"EUR","level":"NORMAL"},{"total":0.2631,"energy":0.1182,"tax":0.1449,"startsAt":"2023-02-24T01:00:00.000+01:00","currency":"EUR","level":"NORMAL"},{"total":0.2624,"energy":0.1176,"tax":0.1448,"startsAt":"2023-02-24T02:00:00.000+01:00","currency":"EUR","level":"CHEAP"},{"total":0.2591,"energy":0.1148,"tax":0.1443,"startsAt":"2023-02-24T03:00:00.000+01:00","currency":"EUR","level":"CHEAP"},{"total":0.2624,"energy":0.1176,"tax":0.1448,"startsAt":"2023-02-24T04:00:00.000+01:00","currency":"EUR","level":"CHEAP"},{"total":0.262,"energy":0.1172,"tax":0.1448,"startsAt":"2023-02-24T05:00:00.000+01:00","currency":"EUR","level":"CHEAP"},{"total":0.2857,"energy":0.1371,"tax":0.1486,"startsAt":"2023-02-24T06:00:00.000+01:00","currency":"EUR","level":"NORMAL"},{"total":0.307,"energy":0.155,"tax":0.152,"startsAt":"2023-02-24T07:00:00.000+01:00","currency":"EUR","level":"NORMAL"},{"total":0.307,"energy":0.155,"tax":0.152,"startsAt":"2023-02-24T08:00:00.000+01:00","currency":"EUR","level":"NORMAL"},{"total":0.3013,"energy":0.1503,"tax":0.151,"startsAt":"2023-02-24T09:00:00.000+01:00","currency":"EUR","level":"NORMAL"},{"total":0.2789,"energy":0.1314,"tax":0.1475,"startsAt":"2023-02-24T10:00:00.000+01:00","currency":"EUR","level":"NORMAL"},{"total":0.2522,"energy":0.109,"tax":0.1432,"startsAt":"2023-02-24T11:00:00.000+01:00","currency":"EUR","level":"CHEAP"},{"total":0.2567,"energy":0.1128,"tax":0.1439,"startsAt":"2023-02-24T12:00:00.000+01:00","currency":"EUR","level":"CHEAP"},{"total":0.2509,"energy":0.1079,"tax":0.143,"startsAt":"2023-02-24T13:00:00.000+01:00","currency":"EUR","level":"CHEAP"},{"total":0.2433,"energy":0.1015,"tax":0.1418,"startsAt":"2023-02-24T14:00:00.000+01:00","currency":"EUR","level":"CHEAP"},{"total":0.2523,"energy":0.1091,"tax":0.1432,"startsAt":"2023-02-24T15:00:00.000+01:00","currency":"EUR","level":"CHEAP"},{"total":0.254,"energy":0.1105,"tax":0.1435,"startsAt":"2023-02-24T16:00:00.000+01:00","currency":"EUR","level":"CHEAP"},{"total":0.2649,"energy":0.1197,"tax":0.1452,"startsAt":"2023-02-24T17:00:00.000+01:00","currency":"EUR","level":"NORMAL"},{"total":0.2848,"energy":0.1364,"tax":0.1484,"startsAt":"2023-02-24T18:00:00.000+01:00","currency":"EUR","level":"NORMAL"},{"total":0.2617,"energy":0.117,"tax":0.1447,"startsAt":"2023-02-24T19:00:00.000+01:00","currency":"EUR","level":"NORMAL"},{"total":0.2312,"energy":0.0914,"tax":0.1398,"startsAt":"2023-02-24T20:00:00.000+01:00","currency":"EUR","level":"CHEAP"},{"total":0.247,"energy":0.1046,"tax":0.1424,"startsAt":"2023-02-24T21:00:00.000+01:00","currency":"EUR","level":"CHEAP"},{"total":0.2333,"energy":0.0931,"tax":0.1402,"startsAt":"2023-02-24T22:00:00.000+01:00","currency":"EUR","level":"CHEAP"},{"total":0.216,"energy":0.0786,"tax":0.1374,"startsAt":"2023-02-24T23:00:00.000+01:00","currency":"EUR","level":"CHEAP"}]

I tried this:
grafik

and get:
grafik

But I want to get just one array with 48 values, can you tell me how to combine?

Example

[{"id":"b9dae1017d51fc2e","type":"inject","z":"452103ea51141731","name":"","props":[{"p":"payload"}],"repeat":"","crontab":"","once":false,"onceDelay":0.1,"topic":"","payload":"","payloadType":"str","x":150,"y":4780,"wires":[["686ddd2f.0bcc64"]]},{"id":"686ddd2f.0bcc64","type":"change","z":"452103ea51141731","name":"","rules":[{"t":"set","p":"payload","pt":"msg","to":"[{\"total\":0.2828,\"energy\":0.1347,\"tax\":0.1481,\"startsAt\":\"2023-02-23T00:00:00.000+01:00\",\"currency\":\"EUR\",\"level\":\"NORMAL\"},{\"total\":0.2789,\"energy\":0.1314,\"tax\":0.1475,\"startsAt\":\"2023-02-23T01:00:00.000+01:00\",\"currency\":\"EUR\",\"level\":\"NORMAL\"},{\"total\":0.276,\"energy\":0.129,\"tax\":0.147,\"startsAt\":\"2023-02-23T02:00:00.000+01:00\",\"currency\":\"EUR\",\"level\":\"NORMAL\"},{\"total\":0.271,\"energy\":0.1248,\"tax\":0.1462,\"startsAt\":\"2023-02-23T03:00:00.000+01:00\",\"currency\":\"EUR\",\"level\":\"NORMAL\"},{\"total\":0.2715,\"energy\":0.1252,\"tax\":0.1463,\"startsAt\":\"2023-02-23T04:00:00.000+01:00\",\"currency\":\"EUR\",\"level\":\"NORMAL\"},{\"total\":0.2771,\"energy\":0.1299,\"tax\":0.1472,\"startsAt\":\"2023-02-23T05:00:00.000+01:00\",\"currency\":\"EUR\",\"level\":\"NORMAL\"},{\"total\":0.3057,\"energy\":0.154,\"tax\":0.1517,\"startsAt\":\"2023-02-23T06:00:00.000+01:00\",\"currency\":\"EUR\",\"level\":\"EXPENSIVE\"},{\"total\":0.3248,\"energy\":0.17,\"tax\":0.1548,\"startsAt\":\"2023-02-23T07:00:00.000+01:00\",\"currency\":\"EUR\",\"level\":\"EXPENSIVE\"},{\"total\":0.3344,\"energy\":0.1781,\"tax\":0.1563,\"startsAt\":\"2023-02-23T08:00:00.000+01:00\",\"currency\":\"EUR\",\"level\":\"EXPENSIVE\"},{\"total\":0.3243,\"energy\":0.1696,\"tax\":0.1547,\"startsAt\":\"2023-02-23T09:00:00.000+01:00\",\"currency\":\"EUR\",\"level\":\"EXPENSIVE\"},{\"total\":0.3065,\"energy\":0.1546,\"tax\":0.1519,\"startsAt\":\"2023-02-23T10:00:00.000+01:00\",\"currency\":\"EUR\",\"level\":\"NORMAL\"},{\"total\":0.3008,\"energy\":0.1498,\"tax\":0.151,\"startsAt\":\"2023-02-23T11:00:00.000+01:00\",\"currency\":\"EUR\",\"level\":\"NORMAL\"},{\"total\":0.2918,\"energy\":0.1422,\"tax\":0.1496,\"startsAt\":\"2023-02-23T12:00:00.000+01:00\",\"currency\":\"EUR\",\"level\":\"NORMAL\"},{\"total\":0.2852,\"energy\":0.1367,\"tax\":0.1485,\"startsAt\":\"2023-02-23T13:00:00.000+01:00\",\"currency\":\"EUR\",\"level\":\"NORMAL\"},{\"total\":0.2835,\"energy\":0.1353,\"tax\":0.1482,\"startsAt\":\"2023-02-23T14:00:00.000+01:00\",\"currency\":\"EUR\",\"level\":\"NORMAL\"},{\"total\":0.2836,\"energy\":0.1354,\"tax\":0.1482,\"startsAt\":\"2023-02-23T15:00:00.000+01:00\",\"currency\":\"EUR\",\"level\":\"NORMAL\"},{\"total\":0.2886,\"energy\":0.1395,\"tax\":0.1491,\"startsAt\":\"2023-02-23T16:00:00.000+01:00\",\"currency\":\"EUR\",\"level\":\"NORMAL\"},{\"total\":0.3038,\"energy\":0.1524,\"tax\":0.1514,\"startsAt\":\"2023-02-23T17:00:00.000+01:00\",\"currency\":\"EUR\",\"level\":\"NORMAL\"},{\"total\":0.3191,\"energy\":0.1652,\"tax\":0.1539,\"startsAt\":\"2023-02-23T18:00:00.000+01:00\",\"currency\":\"EUR\",\"level\":\"NORMAL\"},{\"total\":0.3189,\"energy\":0.165,\"tax\":0.1539,\"startsAt\":\"2023-02-23T19:00:00.000+01:00\",\"currency\":\"EUR\",\"level\":\"NORMAL\"},{\"total\":0.308,\"energy\":0.1559,\"tax\":0.1521,\"startsAt\":\"2023-02-23T20:00:00.000+01:00\",\"currency\":\"EUR\",\"level\":\"NORMAL\"},{\"total\":0.3024,\"energy\":0.1511,\"tax\":0.1513,\"startsAt\":\"2023-02-23T21:00:00.000+01:00\",\"currency\":\"EUR\",\"level\":\"NORMAL\"},{\"total\":0.2958,\"energy\":0.1456,\"tax\":0.1502,\"startsAt\":\"2023-02-23T22:00:00.000+01:00\",\"currency\":\"EUR\",\"level\":\"NORMAL\"},{\"total\":0.2789,\"energy\":0.1315,\"tax\":0.1474,\"startsAt\":\"2023-02-23T23:00:00.000+01:00\",\"currency\":\"EUR\",\"level\":\"NORMAL\"}]","tot":"json"},{"t":"set","p":"topic","pt":"msg","to":"today","tot":"str"}],"action":"","property":"","from":"","to":"","reg":false,"x":300,"y":4780,"wires":[["ffc89816e092b503"]]},{"id":"ffc89816e092b503","type":"join","z":"452103ea51141731","name":"","mode":"custom","build":"object","property":"payload","propertyType":"msg","key":"topic","joiner":"\\n","joinerType":"str","accumulate":false,"timeout":"","count":"2","reduceRight":false,"reduceExp":"","reduceInit":"","reduceInitType":"","reduceFixup":"","x":470,"y":4800,"wires":[["05d46e63ae82c6bb","f1a309fe2e2229a2"]]},{"id":"6727b1c5d30b60d9","type":"change","z":"452103ea51141731","name":"","rules":[{"t":"set","p":"payload","pt":"msg","to":"[{\"total\":0.2816,\"energy\":0.1337,\"tax\":0.1479,\"startsAt\":\"2023-02-24T00:00:00.000+01:00\",\"currency\":\"EUR\",\"level\":\"NORMAL\"},{\"total\":0.2631,\"energy\":0.1182,\"tax\":0.1449,\"startsAt\":\"2023-02-24T01:00:00.000+01:00\",\"currency\":\"EUR\",\"level\":\"NORMAL\"},{\"total\":0.2624,\"energy\":0.1176,\"tax\":0.1448,\"startsAt\":\"2023-02-24T02:00:00.000+01:00\",\"currency\":\"EUR\",\"level\":\"CHEAP\"},{\"total\":0.2591,\"energy\":0.1148,\"tax\":0.1443,\"startsAt\":\"2023-02-24T03:00:00.000+01:00\",\"currency\":\"EUR\",\"level\":\"CHEAP\"},{\"total\":0.2624,\"energy\":0.1176,\"tax\":0.1448,\"startsAt\":\"2023-02-24T04:00:00.000+01:00\",\"currency\":\"EUR\",\"level\":\"CHEAP\"},{\"total\":0.262,\"energy\":0.1172,\"tax\":0.1448,\"startsAt\":\"2023-02-24T05:00:00.000+01:00\",\"currency\":\"EUR\",\"level\":\"CHEAP\"},{\"total\":0.2857,\"energy\":0.1371,\"tax\":0.1486,\"startsAt\":\"2023-02-24T06:00:00.000+01:00\",\"currency\":\"EUR\",\"level\":\"NORMAL\"},{\"total\":0.307,\"energy\":0.155,\"tax\":0.152,\"startsAt\":\"2023-02-24T07:00:00.000+01:00\",\"currency\":\"EUR\",\"level\":\"NORMAL\"},{\"total\":0.307,\"energy\":0.155,\"tax\":0.152,\"startsAt\":\"2023-02-24T08:00:00.000+01:00\",\"currency\":\"EUR\",\"level\":\"NORMAL\"},{\"total\":0.3013,\"energy\":0.1503,\"tax\":0.151,\"startsAt\":\"2023-02-24T09:00:00.000+01:00\",\"currency\":\"EUR\",\"level\":\"NORMAL\"},{\"total\":0.2789,\"energy\":0.1314,\"tax\":0.1475,\"startsAt\":\"2023-02-24T10:00:00.000+01:00\",\"currency\":\"EUR\",\"level\":\"NORMAL\"},{\"total\":0.2522,\"energy\":0.109,\"tax\":0.1432,\"startsAt\":\"2023-02-24T11:00:00.000+01:00\",\"currency\":\"EUR\",\"level\":\"CHEAP\"},{\"total\":0.2567,\"energy\":0.1128,\"tax\":0.1439,\"startsAt\":\"2023-02-24T12:00:00.000+01:00\",\"currency\":\"EUR\",\"level\":\"CHEAP\"},{\"total\":0.2509,\"energy\":0.1079,\"tax\":0.143,\"startsAt\":\"2023-02-24T13:00:00.000+01:00\",\"currency\":\"EUR\",\"level\":\"CHEAP\"},{\"total\":0.2433,\"energy\":0.1015,\"tax\":0.1418,\"startsAt\":\"2023-02-24T14:00:00.000+01:00\",\"currency\":\"EUR\",\"level\":\"CHEAP\"},{\"total\":0.2523,\"energy\":0.1091,\"tax\":0.1432,\"startsAt\":\"2023-02-24T15:00:00.000+01:00\",\"currency\":\"EUR\",\"level\":\"CHEAP\"},{\"total\":0.254,\"energy\":0.1105,\"tax\":0.1435,\"startsAt\":\"2023-02-24T16:00:00.000+01:00\",\"currency\":\"EUR\",\"level\":\"CHEAP\"},{\"total\":0.2649,\"energy\":0.1197,\"tax\":0.1452,\"startsAt\":\"2023-02-24T17:00:00.000+01:00\",\"currency\":\"EUR\",\"level\":\"NORMAL\"},{\"total\":0.2848,\"energy\":0.1364,\"tax\":0.1484,\"startsAt\":\"2023-02-24T18:00:00.000+01:00\",\"currency\":\"EUR\",\"level\":\"NORMAL\"},{\"total\":0.2617,\"energy\":0.117,\"tax\":0.1447,\"startsAt\":\"2023-02-24T19:00:00.000+01:00\",\"currency\":\"EUR\",\"level\":\"NORMAL\"},{\"total\":0.2312,\"energy\":0.0914,\"tax\":0.1398,\"startsAt\":\"2023-02-24T20:00:00.000+01:00\",\"currency\":\"EUR\",\"level\":\"CHEAP\"},{\"total\":0.247,\"energy\":0.1046,\"tax\":0.1424,\"startsAt\":\"2023-02-24T21:00:00.000+01:00\",\"currency\":\"EUR\",\"level\":\"CHEAP\"},{\"total\":0.2333,\"energy\":0.0931,\"tax\":0.1402,\"startsAt\":\"2023-02-24T22:00:00.000+01:00\",\"currency\":\"EUR\",\"level\":\"CHEAP\"},{\"total\":0.216,\"energy\":0.0786,\"tax\":0.1374,\"startsAt\":\"2023-02-24T23:00:00.000+01:00\",\"currency\":\"EUR\",\"level\":\"CHEAP\"}]","tot":"json"},{"t":"set","p":"topic","pt":"msg","to":"tomorrow","tot":"str"}],"action":"","property":"","from":"","to":"","reg":false,"x":320,"y":4840,"wires":[["ffc89816e092b503"]]},{"id":"05d46e63ae82c6bb","type":"change","z":"452103ea51141731","name":"","rules":[{"t":"set","p":"payload","pt":"msg","to":"$append($$.payload.today,$$.payload.tomorrow).{\"x\": $.startsAt, \"y\": $.total}","tot":"jsonata"}],"action":"","property":"","from":"","to":"","reg":false,"x":580,"y":4860,"wires":[["e0e1d82318e724b2"]]},{"id":"f1a309fe2e2229a2","type":"change","z":"452103ea51141731","name":"","rules":[{"t":"set","p":"payload","pt":"msg","to":"$append($$.payload.today,$$.payload.tomorrow)","tot":"jsonata"}],"action":"","property":"","from":"","to":"","reg":false,"x":600,"y":4740,"wires":[["e96b0cb1ed3d06db"]]},{"id":"83c88cc7bdb1eaff","type":"inject","z":"452103ea51141731","name":"","props":[{"p":"payload"}],"repeat":"","crontab":"","once":false,"onceDelay":0.1,"topic":"","payload":"","payloadType":"str","x":150,"y":4840,"wires":[["6727b1c5d30b60d9"]]},{"id":"e0e1d82318e724b2","type":"debug","z":"452103ea51141731","name":"debug 1","active":true,"tosidebar":true,"console":false,"tostatus":false,"complete":"false","statusVal":"","statusType":"auto","x":760,"y":4860,"wires":[]},{"id":"e96b0cb1ed3d06db","type":"debug","z":"452103ea51141731","name":"debug 2","active":true,"tosidebar":true,"console":false,"tostatus":false,"complete":"payload","targetType":"msg","statusVal":"","statusType":"auto","x":780,"y":4740,"wires":[]}]
1 Like

thaaaank yooouuuu (for your patience)

you create the graph with this expression:

$append($$.payload.today,$$.payload.tomorrow).{"x": $.startsAt, "y": $.total}

I´m using this function to create 3 lines:

let mydata = msg.payload;
const chart = [{
    "series": ["Preis gesamt", "Börsenanteil", "Gebührenanteil"],
    "data": [
        mydata.map(e => { return { x: e.startsAt, y: parseFloat((e.total * 100).toFixed(1)) } }),
        mydata.map(e => { return { x: e.startsAt, y: parseFloat((e.energy * 100).toFixed(1)) } }),
        mydata.map(e => { return { x: e.startsAt, y: parseFloat((e.tax * 100).toFixed(1)) } })
    ],
    "labels": []
}];
msg.payload = chart;
msg.topic = "Preis morgen";
return msg;

Do I have to use the function with more than one value (line) ?
or can it also be created with your expression?

That's a personnel choice, function may be slightly faster and could be written with a couple of foreach loops.Or JSONata would be

[{"id":"686ddd2f.0bcc64","type":"change","z":"452103ea51141731","name":"","rules":[{"t":"set","p":"payload","pt":"msg","to":"[{\"total\":0.2828,\"energy\":0.1347,\"tax\":0.1481,\"startsAt\":\"2023-02-23T00:00:00.000+01:00\",\"currency\":\"EUR\",\"level\":\"NORMAL\"},{\"total\":0.2789,\"energy\":0.1314,\"tax\":0.1475,\"startsAt\":\"2023-02-23T01:00:00.000+01:00\",\"currency\":\"EUR\",\"level\":\"NORMAL\"},{\"total\":0.276,\"energy\":0.129,\"tax\":0.147,\"startsAt\":\"2023-02-23T02:00:00.000+01:00\",\"currency\":\"EUR\",\"level\":\"NORMAL\"},{\"total\":0.271,\"energy\":0.1248,\"tax\":0.1462,\"startsAt\":\"2023-02-23T03:00:00.000+01:00\",\"currency\":\"EUR\",\"level\":\"NORMAL\"},{\"total\":0.2715,\"energy\":0.1252,\"tax\":0.1463,\"startsAt\":\"2023-02-23T04:00:00.000+01:00\",\"currency\":\"EUR\",\"level\":\"NORMAL\"},{\"total\":0.2771,\"energy\":0.1299,\"tax\":0.1472,\"startsAt\":\"2023-02-23T05:00:00.000+01:00\",\"currency\":\"EUR\",\"level\":\"NORMAL\"},{\"total\":0.3057,\"energy\":0.154,\"tax\":0.1517,\"startsAt\":\"2023-02-23T06:00:00.000+01:00\",\"currency\":\"EUR\",\"level\":\"EXPENSIVE\"},{\"total\":0.3248,\"energy\":0.17,\"tax\":0.1548,\"startsAt\":\"2023-02-23T07:00:00.000+01:00\",\"currency\":\"EUR\",\"level\":\"EXPENSIVE\"},{\"total\":0.3344,\"energy\":0.1781,\"tax\":0.1563,\"startsAt\":\"2023-02-23T08:00:00.000+01:00\",\"currency\":\"EUR\",\"level\":\"EXPENSIVE\"},{\"total\":0.3243,\"energy\":0.1696,\"tax\":0.1547,\"startsAt\":\"2023-02-23T09:00:00.000+01:00\",\"currency\":\"EUR\",\"level\":\"EXPENSIVE\"},{\"total\":0.3065,\"energy\":0.1546,\"tax\":0.1519,\"startsAt\":\"2023-02-23T10:00:00.000+01:00\",\"currency\":\"EUR\",\"level\":\"NORMAL\"},{\"total\":0.3008,\"energy\":0.1498,\"tax\":0.151,\"startsAt\":\"2023-02-23T11:00:00.000+01:00\",\"currency\":\"EUR\",\"level\":\"NORMAL\"},{\"total\":0.2918,\"energy\":0.1422,\"tax\":0.1496,\"startsAt\":\"2023-02-23T12:00:00.000+01:00\",\"currency\":\"EUR\",\"level\":\"NORMAL\"},{\"total\":0.2852,\"energy\":0.1367,\"tax\":0.1485,\"startsAt\":\"2023-02-23T13:00:00.000+01:00\",\"currency\":\"EUR\",\"level\":\"NORMAL\"},{\"total\":0.2835,\"energy\":0.1353,\"tax\":0.1482,\"startsAt\":\"2023-02-23T14:00:00.000+01:00\",\"currency\":\"EUR\",\"level\":\"NORMAL\"},{\"total\":0.2836,\"energy\":0.1354,\"tax\":0.1482,\"startsAt\":\"2023-02-23T15:00:00.000+01:00\",\"currency\":\"EUR\",\"level\":\"NORMAL\"},{\"total\":0.2886,\"energy\":0.1395,\"tax\":0.1491,\"startsAt\":\"2023-02-23T16:00:00.000+01:00\",\"currency\":\"EUR\",\"level\":\"NORMAL\"},{\"total\":0.3038,\"energy\":0.1524,\"tax\":0.1514,\"startsAt\":\"2023-02-23T17:00:00.000+01:00\",\"currency\":\"EUR\",\"level\":\"NORMAL\"},{\"total\":0.3191,\"energy\":0.1652,\"tax\":0.1539,\"startsAt\":\"2023-02-23T18:00:00.000+01:00\",\"currency\":\"EUR\",\"level\":\"NORMAL\"},{\"total\":0.3189,\"energy\":0.165,\"tax\":0.1539,\"startsAt\":\"2023-02-23T19:00:00.000+01:00\",\"currency\":\"EUR\",\"level\":\"NORMAL\"},{\"total\":0.308,\"energy\":0.1559,\"tax\":0.1521,\"startsAt\":\"2023-02-23T20:00:00.000+01:00\",\"currency\":\"EUR\",\"level\":\"NORMAL\"},{\"total\":0.3024,\"energy\":0.1511,\"tax\":0.1513,\"startsAt\":\"2023-02-23T21:00:00.000+01:00\",\"currency\":\"EUR\",\"level\":\"NORMAL\"},{\"total\":0.2958,\"energy\":0.1456,\"tax\":0.1502,\"startsAt\":\"2023-02-23T22:00:00.000+01:00\",\"currency\":\"EUR\",\"level\":\"NORMAL\"},{\"total\":0.2789,\"energy\":0.1315,\"tax\":0.1474,\"startsAt\":\"2023-02-23T23:00:00.000+01:00\",\"currency\":\"EUR\",\"level\":\"NORMAL\"}]","tot":"json"},{"t":"set","p":"topic","pt":"msg","to":"today","tot":"str"}],"action":"","property":"","from":"","to":"","reg":false,"x":240,"y":4900,"wires":[["ffc89816e092b503"]]},{"id":"b9dae1017d51fc2e","type":"inject","z":"452103ea51141731","name":"","props":[{"p":"payload"}],"repeat":"","crontab":"","once":false,"onceDelay":0.1,"topic":"","payload":"","payloadType":"str","x":90,"y":4900,"wires":[["686ddd2f.0bcc64"]]},{"id":"ffc89816e092b503","type":"join","z":"452103ea51141731","name":"","mode":"custom","build":"object","property":"payload","propertyType":"msg","key":"topic","joiner":"\\n","joinerType":"str","accumulate":false,"timeout":"","count":"2","reduceRight":false,"reduceExp":"","reduceInit":"","reduceInitType":"","reduceFixup":"","x":410,"y":4920,"wires":[["05d46e63ae82c6bb"]]},{"id":"6727b1c5d30b60d9","type":"change","z":"452103ea51141731","name":"","rules":[{"t":"set","p":"payload","pt":"msg","to":"[{\"total\":0.2816,\"energy\":0.1337,\"tax\":0.1479,\"startsAt\":\"2023-02-24T00:00:00.000+01:00\",\"currency\":\"EUR\",\"level\":\"NORMAL\"},{\"total\":0.2631,\"energy\":0.1182,\"tax\":0.1449,\"startsAt\":\"2023-02-24T01:00:00.000+01:00\",\"currency\":\"EUR\",\"level\":\"NORMAL\"},{\"total\":0.2624,\"energy\":0.1176,\"tax\":0.1448,\"startsAt\":\"2023-02-24T02:00:00.000+01:00\",\"currency\":\"EUR\",\"level\":\"CHEAP\"},{\"total\":0.2591,\"energy\":0.1148,\"tax\":0.1443,\"startsAt\":\"2023-02-24T03:00:00.000+01:00\",\"currency\":\"EUR\",\"level\":\"CHEAP\"},{\"total\":0.2624,\"energy\":0.1176,\"tax\":0.1448,\"startsAt\":\"2023-02-24T04:00:00.000+01:00\",\"currency\":\"EUR\",\"level\":\"CHEAP\"},{\"total\":0.262,\"energy\":0.1172,\"tax\":0.1448,\"startsAt\":\"2023-02-24T05:00:00.000+01:00\",\"currency\":\"EUR\",\"level\":\"CHEAP\"},{\"total\":0.2857,\"energy\":0.1371,\"tax\":0.1486,\"startsAt\":\"2023-02-24T06:00:00.000+01:00\",\"currency\":\"EUR\",\"level\":\"NORMAL\"},{\"total\":0.307,\"energy\":0.155,\"tax\":0.152,\"startsAt\":\"2023-02-24T07:00:00.000+01:00\",\"currency\":\"EUR\",\"level\":\"NORMAL\"},{\"total\":0.307,\"energy\":0.155,\"tax\":0.152,\"startsAt\":\"2023-02-24T08:00:00.000+01:00\",\"currency\":\"EUR\",\"level\":\"NORMAL\"},{\"total\":0.3013,\"energy\":0.1503,\"tax\":0.151,\"startsAt\":\"2023-02-24T09:00:00.000+01:00\",\"currency\":\"EUR\",\"level\":\"NORMAL\"},{\"total\":0.2789,\"energy\":0.1314,\"tax\":0.1475,\"startsAt\":\"2023-02-24T10:00:00.000+01:00\",\"currency\":\"EUR\",\"level\":\"NORMAL\"},{\"total\":0.2522,\"energy\":0.109,\"tax\":0.1432,\"startsAt\":\"2023-02-24T11:00:00.000+01:00\",\"currency\":\"EUR\",\"level\":\"CHEAP\"},{\"total\":0.2567,\"energy\":0.1128,\"tax\":0.1439,\"startsAt\":\"2023-02-24T12:00:00.000+01:00\",\"currency\":\"EUR\",\"level\":\"CHEAP\"},{\"total\":0.2509,\"energy\":0.1079,\"tax\":0.143,\"startsAt\":\"2023-02-24T13:00:00.000+01:00\",\"currency\":\"EUR\",\"level\":\"CHEAP\"},{\"total\":0.2433,\"energy\":0.1015,\"tax\":0.1418,\"startsAt\":\"2023-02-24T14:00:00.000+01:00\",\"currency\":\"EUR\",\"level\":\"CHEAP\"},{\"total\":0.2523,\"energy\":0.1091,\"tax\":0.1432,\"startsAt\":\"2023-02-24T15:00:00.000+01:00\",\"currency\":\"EUR\",\"level\":\"CHEAP\"},{\"total\":0.254,\"energy\":0.1105,\"tax\":0.1435,\"startsAt\":\"2023-02-24T16:00:00.000+01:00\",\"currency\":\"EUR\",\"level\":\"CHEAP\"},{\"total\":0.2649,\"energy\":0.1197,\"tax\":0.1452,\"startsAt\":\"2023-02-24T17:00:00.000+01:00\",\"currency\":\"EUR\",\"level\":\"NORMAL\"},{\"total\":0.2848,\"energy\":0.1364,\"tax\":0.1484,\"startsAt\":\"2023-02-24T18:00:00.000+01:00\",\"currency\":\"EUR\",\"level\":\"NORMAL\"},{\"total\":0.2617,\"energy\":0.117,\"tax\":0.1447,\"startsAt\":\"2023-02-24T19:00:00.000+01:00\",\"currency\":\"EUR\",\"level\":\"NORMAL\"},{\"total\":0.2312,\"energy\":0.0914,\"tax\":0.1398,\"startsAt\":\"2023-02-24T20:00:00.000+01:00\",\"currency\":\"EUR\",\"level\":\"CHEAP\"},{\"total\":0.247,\"energy\":0.1046,\"tax\":0.1424,\"startsAt\":\"2023-02-24T21:00:00.000+01:00\",\"currency\":\"EUR\",\"level\":\"CHEAP\"},{\"total\":0.2333,\"energy\":0.0931,\"tax\":0.1402,\"startsAt\":\"2023-02-24T22:00:00.000+01:00\",\"currency\":\"EUR\",\"level\":\"CHEAP\"},{\"total\":0.216,\"energy\":0.0786,\"tax\":0.1374,\"startsAt\":\"2023-02-24T23:00:00.000+01:00\",\"currency\":\"EUR\",\"level\":\"CHEAP\"}]","tot":"json"},{"t":"set","p":"topic","pt":"msg","to":"tomorrow","tot":"str"}],"action":"","property":"","from":"","to":"","reg":false,"x":260,"y":4960,"wires":[["ffc89816e092b503"]]},{"id":"05d46e63ae82c6bb","type":"change","z":"452103ea51141731","name":"","rules":[{"t":"set","p":"payload","pt":"msg","to":"(\t   $data := $append($$.payload.today,$$.payload.tomorrow)[[0..2]];\t   $series := {\t       \"total\": \"Preis gesamt\",\t       \"energy\": \"Börsenanteil\",\t       \"tax\": \"Gebührenanteil\"\t   };\t   [\t       {\t           \"series\": $series.*[],\t           \"data\": \t               $keys($series)@$i.\t                   [\t                       [\t                           $data.{\"x\": $.startsAt, \"y\": $lookup($,$i)}\t                       ]\t                   ]\t                                 \t        }\t    ]\t)\t\t\t","tot":"jsonata"}],"action":"","property":"","from":"","to":"","reg":false,"x":560,"y":4920,"wires":[["e0e1d82318e724b2","ced62eb493176e49"]]},{"id":"83c88cc7bdb1eaff","type":"inject","z":"452103ea51141731","name":"","props":[{"p":"payload"}],"repeat":"","crontab":"","once":false,"onceDelay":0.1,"topic":"","payload":"","payloadType":"str","x":90,"y":4960,"wires":[["6727b1c5d30b60d9"]]},{"id":"e0e1d82318e724b2","type":"debug","z":"452103ea51141731","name":"debug 1","active":true,"tosidebar":true,"console":false,"tostatus":false,"complete":"false","statusVal":"","statusType":"auto","x":700,"y":4980,"wires":[]}]
(
   $data := $append($$.payload.today,$$.payload.tomorrow)[[0..2]];
   $series := {
       "total": "Preis gesamt",
       "energy": "Börsenanteil",
       "tax": "Gebührenanteil"
   };
   [
       {
           "series": $series.*[],
           "data": 
               $keys($series)@$i.
                   [
                       [
                           $data.{"x": $.startsAt, "y": $lookup($,$i)}
                       ]
                   ]
                                 
        }
    ]
)

Best stick to code you understand though.

2 Likes

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