Added quick time period selection buttons.

This commit is contained in:
neviyn 2018-12-19 10:32:10 +00:00
parent 28d75df455
commit 892128a4be

View File

@ -13,9 +13,23 @@
</button>
</div>
</b-modal>
<b-row>
<b-col><b-button @click="chartMode = 0; getFilteredAverage()">Trends</b-button></b-col>
<b-col><b-button @click="chartMode = 1; getFilteredAverage()">AFIs</b-button></b-col>
<b-row class="pb-2">
<b-col>
<b-button-group size="sm">
<b-button variant="dark">Select Chart:</b-button>
<b-button variant="outline-primary" @click="chartMode = 0; getFilteredAverage()">Trends</b-button>
<b-button variant="outline-primary" @click="chartMode = 1; getFilteredAverage()">AFIs</b-button>
</b-button-group>
</b-col>
<b-col>
<b-button-group size="sm">
<b-button variant="dark">Quick Interval:</b-button>
<b-button variant="outline-primary" v-on:click="setInterval(1, 'w'); getFilteredAverage()">1 Week</b-button>
<b-button variant="outline-primary" v-on:click="setInterval(1, 'M'); getFilteredAverage()">1 Month</b-button>
<b-button variant="outline-primary" v-on:click="setInterval(3, 'M'); getFilteredAverage()">3 Months</b-button>
<b-button variant="outline-primary" v-on:click="setInterval(1, 'y'); getFilteredAverage()">1 Year</b-button>
</b-button-group>
</b-col>
</b-row>
<b-row>
<b-col>
@ -228,6 +242,10 @@ export default {
},
changeEndDate: function(e) {
this.endDate = e.date;
},
setInterval: function(amount, timeType){
this.endDate = moment();
this.startDate = moment().subtract(amount, timeType);
}
},
watch: {