How to draw a chart for only one data point.
-
Hello.
Working with the Dashboard I've seen multiple examples of charts, gauges, etc. and in them always is showed a selection list of data points, and when you select one, his chart is shown. But I'd like to make a Dashboard to show only one data point with his chart and that the user can't select another one (because there is no selection list). Could this be done? How?
Thanks.
-
Here's how I did it.
<!-- Get point values --> <ma-point-values point-xid="hallsFanInletAirTemp" point="inletAir"></ma-point-values> <!-- Create a way to manupulate point values to 12 previous hours and update. In this example, I am getting previous 12 hours at a 1 minute average. You only have to do this once --> <ma-now update-interval="1 minutes" output="to"></ma-now> <ma-calc input="to | moment:'subtract':12:'hours'" output="from"></ma-calc> <!-- Manipulate the actual values of the point. This code can be multiplied for as many points as you want --> <ma-point-values point="inletAir" values="inletAirValues" from="from" to="to" rollup="AVERAGE" rollup-interval="1 minutes"> </ma-point-values> <!-- Display Chart --> <ma-serial-chart style="height: 500px; width: 100%" series-1-values="inletAirValues" series-1-point="inletAir" series-1-color="green" series-1-axis="left" series-1-type="line" legend="true" baloon="false" options="{ valueAxes:[ { axisColor:'black', color:'black', title: 'Temperature °F', titleColor: 'black', minimum:-40, maximum:140, fontSize:26, titleFontSize:26, }, ] }" > </ma-serial-chart>
-
@jefero
Have a look at the API documentation forma-point-values
you can pass in a point's XID as an attribute. -
Thank both of you.
It is true, the solution is to change the attribute "point":
<ma-point-values point="point1"by the attribute "point-xid" with the XID of the data point you want to draw:
<ma-point-values point-xid="myXID"Could be a good idea to add an example to the "Mango Dashboard Examples" with this option to draw a chart.
Thanks.