Problem: You need to display a table of temperatures.
Sample data (temperatures): 67.4, 69.5, 72.5, 67.8, 65.0
We will use a function node to create the table using:
var arr =[67.4, 69.5, 72.5, 67.8, 65.0];
msg.payload = arr;
return msg;
In real life you probably have a sensor generating the data.
Next, we will display the table using the template node. Here is what we use in the template node:
<table id="table" border="1">
<tr>
<th>Temperature</th>
</tr>
<tbody>
<tr ng-repeat="row in msg.payload">
<td class="numeric" >{{row}}</td>
</tr>
</tbody>
</table>
Notice that the TR element has a ng-repeat option that is the key to displaying all rows of the table.
Here is what the display will look like:
Temperature |
---|
67.4 |
69.5 |
72.5 |
67.8 |
65.0 |
the following is the flow that is used in this example:
Resulting dashboard