I'm starting working in dashboard.
I'm able to print out msg. payload vars inside html / div tags.
My question how I can use msg.paylod vars inside js script tags.
Looks like simple {{msg.payload.data[0]}} will not work.
I read the help for template but still not clear for me.
I'd like to achive this
<script>
// works fine
//series: [3.4, 0, 3.5, 6.944 ],
//labels: ["Bat geladen", "Grid Verkauf", "PV Selbstverbrauch", "PV heute"],
// don't work
series: {msg.payload.series},
labels: {{msg.palette.labels}},
</script>
sorry may I was misunderstandable. It is not about data it is about, how can I pass values (array) from payload.series + payload.labels to js script tag (apex chart option section) to achive this:
series: [3.4, 0, 3.5, 6.944 ],
as mention before msg.payload.series hold as array the values [3.4, 0, 3.5, 6.944 ].
that is exactly what the 3 examples I gave you do - that pass something from server side (node-red runtime) to the template in the client side (aka dashboard) - you have to determine what to do with the data.
Pick any one of the examples I offered and add alert(msg) inside the watch and you will see that data is being passed from Node-RED to Dashboard.
If you want a particular example based on apex - forum search reveals some clues
When checking the chart object in chrome console I found out the data already there but it looks like the chart renderer was starting before and did not update the chart.
Now I encapsulate all in the scope.#whatch and this did the job