4. Adding Data to Gauge Nodes

Now that we have two gauges ready to be populated with data, we will add two inject nodes and two function node. The inject nodes will trigger the function nodes, and the function nodes will simulate the fake data.
Once we place the nodes into the canvas, we connect the inject node to the function node, and the function node to the gauge node. We also add a comment node in order to better display each group, which will help us visualize everything as we continue to build our dashboard.
Next, double click the top function node tied to the Temperature Gauge and type the following code in order to generate values that simulate tank temperatures.
msg.payload = Math.round(Math.random()*10)+70;
return msg;
We will also change the name to Tank Temperature. Once complete click Done.
Similar to the temperature function node, double-click on the function node tied to the pH level gauge, type in the following code as well as change the name to Tank pH. Once complete click Done.
msg.payload = (Math.random() + 6.5).toFixed(1);
return msg;
Now that we have our functions in place, we will use the inject node to trigger these functions every 3 seconds. To do this, double-click on each inject node and change the following parameters.
Once each inject node has been changed, double-click the comment node and change the name to Temperature/pH monitor Section. Your canvas should now look like this
We can now click Deploy, and click on each one of the inject nodes to trigger the functions. This will start populating data in our dashboard, as shown below.