Charts for past 12 hours
-
Hi All,
I want to create a chart which shows the value of multiple points over the past 12 hours. It is my understanding that I should use
ma-point-values
which will then return an array which I can pass into the chart, is that correct?I also want the chart to update every x minutes, what is the best way to do that? I think if I use
ma-point-values
every time the chart updates it will query for ALL 12 hours of data again, is that right, is there a better way? Thelatest
attribute wouldn't work for us since some points might have 100 values over 12 hours, some might have 3000.Thanks!
-
Correct, look under API Docs -> Components -> maSerialChart
They have a complete guideline of what attribute tags to use to apply values. You will want the series-x-values where the x is the chart number.
The Chart update rate is affected by the maPointValues components which you can also read about. The realtime="true" attribute will allow datapoints to update into the chart at the rate they change or are updated.
If you don't want to average, make sure you set the rollup type to NONE. Alternatively, use the rollup-interval to set the interval duration between datapoints in the chart, note that changing from the live updating rate may mean you;ll need to average. -
@mattfox said in Charts for past 12 hours:
If you don't want to average, make sure you set the rollup type to NONE. Alternatively, use the rollup-interval to set the interval duration between datapoints in the chart, note that changing from the live updating rate may mean you;ll need to average.
Thank you!
It looks like
realtime
only works if you uselatest
, which we cannot use since it only retrieves the latest X point values, rather than the latest X hours of point values.I'll poke around some more, but thanks again for the detailed response!
-
if you use the ma-now directive and combine it with a maMoment filter for your point values, you can then have it updating for the last 12 hours fixed.
<ma-now update-interval="1 SECONDS" output="timeNow"></ma-now> <!-- change to minutes or hours as required --> <ma-point-values point="device" values="seasonal" from="timeNow | maMoment : subtract : '12 hours'" to="timeNow" rollup="ACCUMULATOR" rollup-interval="1 DAYS"></ma-point-values>
I believe it's something to that effect off the top of my head...