ma-date-range-picker
-
Hello
I can set 00:00 to 23:59:59 in one day and one month to 30 days.But if this is 2018/06/17, there should be only 17 days. I have to solve in some parts to get what I want.
I want- 00:00:00, 2018/06/17 - 20:50:59 2018/06/17
00:00:00, 2018/06/16 - 23:59:59 2018/06/16
....
00:00:00, 2018/06/2 - 23:59:59 2018/06/2
00:00:00, 2018/06/1 - 23:59:59 2018/06/1
I do not want
Now at 20:50:59 2018/06/17, preset usage = "LAST_1_DAYS" is 20:50:59, 2018/06/16.
My code
<ma-date-range-picker style="display: none" update-interval="1 minutes" preset="LAST_1_MONTHS" to="dateBar1.to" from="dateBar1.from"></ma-date-range-picker> <div id="1414555" style="width: 400px; height: 35px; position: absolute; left: 23px; top: 65px;" layout="row"> <md-input-container flex=""> <label>From date</label> <ma-date-picker format="DD-MM-YYYY" mode="date" ng-model="dateBar1.from" disabled=""></ma-date-picker> </md-input-container> <md-input-container flex=""> <label>To date</label> <ma-date-picker format="DD-MM-YYYY" mode="date" ng-model="dateBar1.to" disabled=""></ma-date-picker> </md-input-container> </div> <div id="RowColor55" style="width: 127.875px; height: 53.8594px; position: absolute; left: -1px; top: 55.2031px;" layout="row"> <md-input-container flex="50" ng-init="point1monthColor='#00a300'"> </md-input-container> </div> <div id="RowChartType55" style="width: 299.922px; height: 53.8594px; position: absolute; left: -1px; top: 55.2031px;" layout="row"> <md-input-container flex="50" ng-init="point1monthChartType='column'"> </md-input-container> </div> <ma-point-values to="dateBar1.to" from="dateBar1.from" point-xid="PJST_SMA_Day_yield" values="point1monthValues" rollup="MAXIMUM" rollup-interval="1 days"></ma-point-values> <ma-serial-chart id="dddd55" style="height: 312.766px; width: 740.766px; position: absolute; left: 0px; top: 170px;" options="{legend:{},valueAxes:[{title: 'Energy(kWh)'}]}" export="true" balloon="true" legend="true" default-axis="left" series-1-type="{{point1monthChartType}}" series-1-color="{{point1monthColor}}" series-1-point="myP1" series-1-values="point1monthValues" series-1-title="PV production"> </ma-serial-chart>
- 00:00:00, 2018/06/17 - 20:50:59 2018/06/17
-
@desle said in ma-date-range-picker:
<ma-date-range-picker style="display: none" update-interval="1 minutes" preset="LAST_1_MONTHS" to="dateBar1.to" from="dateBar1.from"></ma-date-range-picker>
Hi, for a start change change
preset="LAST_1_MONTHS"
topreset="MONTH_SO_FAR"
That will give you from the beginning of the month.Let me know how that goes
Fox
-
@mattfox I do not understand how to use it. Can i have a sample.I understand that if I use the last 1 months is now-24hr. Can I set up 00:00:00 - 23:59:59 one day?
-
You can indeed.
Are you requiring the ability to both select this month to date or show the whole day, or can they be two separate charts?
Noting that if the date-range-picker is changed, you would have to manually update the end time yourself.The amended code for above:
<ma-date-range-picker style="display: none" update-interval="1 minutes" preset="MONTH_SO_FAR" to="dateBar1.to" from="dateBar1.from"></ma-date-range-picker> <div id="1414555" style="width: 400px; height: 35px; position: absolute; left: 23px; top: 65px;" layout="row"> <md-input-container flex=""> <label>From date</label> <ma-date-picker format="DD-MM-YYYY" mode="date" ng-model="dateBar1.from" disabled=""></ma-date-picker> </md-input-container> <md-input-container flex=""> <label>To date</label> <ma-date-picker format="DD-MM-YYYY" mode="date" ng-model="dateBar1.to" disabled=""></ma-date-picker> </md-input-container> </div> <div id="RowColor55" style="width: 127.875px; height: 53.8594px; position: absolute; left: -1px; top: 55.2031px;" layout="row"> <md-input-container flex="50" ng-init="point1monthColor='#00a300'"> </md-input-container> </div> <div id="RowChartType55" style="width: 299.922px; height: 53.8594px; position: absolute; left: -1px; top: 55.2031px;" layout="row"> <md-input-container flex="50" ng-init="point1monthChartType='column'"> </md-input-container> </div> <ma-point-values to="dateBar1.to" from="dateBar1.from" point-xid="PJST_SMA_Day_yield" values="point1monthValues" rollup="MAXIMUM" rollup-interval="1 days"></ma-point-values> <ma-serial-chart id="dddd55" style="height: 312.766px; width: 740.766px; position: absolute; left: 0px; top: 170px;" options="{legend:{},valueAxes:[{title: 'Energy(kWh)'}]}" export="true" balloon="true" legend="true" default-axis="left" series-1-type="{{point1monthChartType}}" series-1-color="{{point1monthColor}}" series-1-point="myP1" series-1-values="point1monthValues" series-1-title="PV production"> </ma-serial-chart>
EDIT:
For obtaining and enforcing the beginning and end of the day (saves you having to edit the date/time in the date picker field):<p>FROM: {{dateBar1.from | maMoment:'startOf':'day'}}</p> <p>TO: {{dateBar1.to| maMoment:'endOf':'day'}}</p>
So your <ma-point-values> component will be like this:
<ma-point-values to="dateBar1.to | maMoment:'endOf':'day'" from="dateBar1.from | maMoment:'startOf':'day'" point-xid="PJST_SMA_Day_yield" values="point1monthValues" rollup="MAXIMUM" rollup-interval="1 days"></ma-point-values>
-
@DESLE I can't quite work out what exactly you are looking for. Hopefully what @MattFox provided might help you.
Like he said it seems that you just need to use
preset="MONTH_SO_FAR"
and a rollup of 1 day.@desle said in ma-date-range-picker:
Can I set up 00:00:00 - 23:59:59 one day?
Just remember that with date/time ranges the start is inclusive and the end is exclusive. e.g. if you query the API for 2018-06-17 00:00:00 to 2018-06-18 00:00:00 and there is a point value at exactly 2018-06-18 00:00:00 then it will not be returned.
Another way to look at it is this, if there was a point value at 23:59:59.500 (500ms to midnight) then it would not be returned if you queried for 2018-06-17 00:00:00 to 2018-06-17 23:59:59, you should be querying up to 2018-06-18 00:00:00