If you take a look at the info box for the chart node, you’ll see it mentions that the the msg.topic field can be used to show multiple lines. Ok, now let’s see how to add another line to the same chart. You can also see “Default” at the top left of the chart, indicating this is UI group “Default” – which is the group name we set in the configuration fields for the chart node. When you visit that page you’ll see your initial chart as shown below:Īs you can see, you get a nice line chart, scaled for your data values (X axis) and the time they arrived (y axis). You can see your default dashboard by selecting menu->view->dashboard and then clicking on the link icon to start up a new browser tab showing your dashboard. Then head over to your default dashboard page to see the results. Wire these nodes up, hit the deploy button – check that your debug node is showing that random values are showing. The other fields don’t need to be updated at the moment – but their names should be clear – we’ll revisit some of these later. Let’s use a short 5 mins which will start to throw away the data that is 5 minutes old. The X-axis field allows you to tell the chart how much data it should store and display – the longer the ‘ last‘ filed is set to, the more data is stored and displayed by the chart. The Group field allows you to group UI elements – we’ll show you how that works when we add another UI element so let’s use group “Default” for now – of course, you can use any string you like. The Label field is the chart name you want on the dashboard – by default this is chart but you can set it to anything you like. However, we’ll use the default home for now.Ĭlick update to save changes to the dashboard group node and let’s go back to our chart node and look at at its fields If you select the edit button to the right of the Tab field you can create a new tab and then select that. The default tab is Home – which we are using here. The Tab option allows you to specify which tab of the UI page you will see the UI element on – in this case our chart. If you click on the button of the Group field, you will be prompted to configure the UI group. When you double click it, you’ll see it’s configuration options: So now let’s take a look at the chart node. This will generate a random number between 0 ~ 99 which is passed to the chart node. Now we need to set up the function node to generate a random number – we’ll use a simple JS math function to do this: msg.payload = Math.round(Math.random()*100) īefore we look a how the chart node works, let’s configure the inject node to send a timestamp every 5 seconds by setting the payload to timestamp and the repeat field to an interval of 5 seconds. For that you’ll need an inject node to repeatedly fire every few seconds, a function node to generate the random number and one of the node-red-dashboard nodes – in this case the chart node. To start, let’s wire up a simple flow that sends a random number between 0 and 99 to a simple chart. As discussed in that lecture, let’s start by setting up a simple flow to generate a random number and display it on a chart.
0 Comments
Leave a Reply. |
AuthorWrite something about yourself. No need to be fancy, just an overview. ArchivesCategories |