Setting "from" and "to" to only last 7 days without range picker
-
Hello all,
I have a daily sum of some data, and I want to display the last 7 days of it on a bar graph. Is there any documentation for other values that can go into the from and to rather than just a range picker?<ma-point-values point="myPoint3" values="point3Values" rollup="SUM" rollup-interval="1 DAYS" from="?" to="?">
</ma-point-values>On other graphs I have used ' latest="7" ' to show the last 7 days, but those were calculated daily in mango. When used in the line above, it doesn't seem to use the rollup. Any ideas?
Thanks,
Stephen -
Have you seen this post http://infiniteautomation.com/forum/topic/2216/how-to-simulate-presetpicker-change-with-buttons? I think it may be helpful.
-
I have, but I'm still unsure of options I have for from="" and to="" without using date picker.
-
Hey Stephen,
Here's a quick example of how to do what you are asking for. You use the ma-now directive to get the current time then use the moment filter to manipulate the from time.
<div layout="row"> <md-input-container flex=""> <label>Choose a point</label> <ma-point-list limit="200" ng-model="point1"></ma-point-list> </md-input-container> </div> <ma-now update-interval="1 HOURS" output="theTimeNow"></ma-now> <ma-point-values point="point1" values="point1Values" from="theTimeNow | moment:'startOf':'day'|moment:'subtract':7:'days'" to="theTimeNow" rollup="SUM" rollup-interval="1 DAYS"> </ma-point-values> <ma-serial-chart style="height: 300px; width: 100%" series-1-values="point1Values" series-1-point="point1" default-type="column"> </ma-serial-chart>
-
Great that seems to have worked, Thank you.
-
I may have spoke too soon.
The graph is displaying the information the way it should be, but it's causing issues with the rest of the dashboard. It's displaying itself on other tabs, and when I click back to it's tab, it brings other graphs to that one. The graphs code are on different html files. -
If you post up your markup I'll help you.
-
Here's the code, I tried using some other examples that use 'moment' from the forum and the same issue arises, but anyway:
<h3>Weekly Heat Transfer</h3>
<div class="row hidden-xs">
<div class="col-sm-12 text-center extraPadding chart-holder">
<ma-now update-interval="1 HOURS" output="theTimeNow"></ma-now>
<ma-get-point-value point-xid="DP_672608" point="myPoint3"></ma-get-point-value>
<ma-point-values point="myPoint3" values="point3Values"
from="theTimeNow | moment:'startOf':'day'|moment:'subtract':7:'days'"
to="theTimeNow" rollup="SUM" rollup-interval="1 DAYS">
</ma-point-values>
<ma-get-point-value point-xid="DP_284166" point="myPoint7"></ma-get-point-value>
<ma-point-values point="myPoint7" values="point7Values" latest="8">
</ma-point-values>
<ma-serial-chart style="height: 300px; width: 100%"series-1-values="point3Values" series-1-point="myPoint3" series-1-color="purple" series-1-type="column" series-3-values="point7Values" series-3-point="myPoint7" series-3-axis="right" series-3-type="column" series-3-color="green" options="{ valueAxes:[ {title:'kJ', axisColor:'black', color:'black'}, {title:'Outside Temp (°C)', axisColor:'green', color:'green'} ] }"> </ma-serial-chart> </div>
</div>
-
I can't really solve your problems with the tabs unless you post up the full markup, please wrap the markup between three backticks so the code is formatted (use the code button on the toolbar).
From what I can see though you are trying to plot two points on a graph but for the second point you are using
latest="8"
which is giving funny results, try using the same set of attributes for both<ma-point-values>
-
Sorry, didn't know about that button, I'll also try and change the other time scale and see what happens. Thanks
h3>Weekly Heat Transfer</h3> <div class="row hidden-xs"> <div class="col-sm-12 text-center extraPadding chart-holder"> <ma-now update-interval="1 HOURS" output="theTimeNow"></ma-now> <ma-get-point-value point-xid="DP_672608" point="myPoint3"></ma-get-point-value> <ma-point-values point="myPoint3" values="point3Values" from="theTimeNow | moment:'startOf':'day'|moment:'subtract':7:'days'" to="theTimeNow" rollup="SUM" rollup-interval="1 DAYS"> </ma-point-values> <ma-get-point-value point-xid="DP_284166" point="myPoint7"></ma-get-point-value> <ma-point-values point="myPoint7" values="point7Values" latest="8"> </ma-point-values> <ma-serial-chart style="height: 300px; width: 100%" series-1-values="point3Values" series-1-point="myPoint3" series-1-color="purple" series-1-type="column" series-3-values="point7Values" series-3-point="myPoint7" series-3-axis="right" series-3-type="column" series-3-color="green" options="{ valueAxes:[ {title:'kJ', axisColor:'black', color:'black'}, {title:'Outside Temp (°C)', axisColor:'green', color:'green'} ] }"> </ma-serial-chart> </div> </div>
-
Changing the time scale for the second point to use moment didn't change any of the issues.
-
You mentioned you were having issues with tabs, if you post up your full markup for the dashboard including the tabs I can help you. Without this I am clutching at straws.
-
Sorry but when you say full markup do you want the app.js file as well? I'm using the dashboard template and building off it.
-
Everything is preferable yes, you can email it to me at jared@infiniteautomation.com if you would like.