Change Graphs to typescript

This commit is contained in:
Matthias 2020-06-22 08:05:03 +02:00
parent 222d9e9c40
commit 6a1d39471f
2 changed files with 37 additions and 26 deletions

View File

@ -16,6 +16,7 @@ const MARGINRIGHT = '4%';
// TODO plotConfig should come from the backend, or be configurable via UI
const plotConfig = {
// eslint-disable-next-line @typescript-eslint/camelcase
main_plot: {
tema: { color: 'orange' },
},

View File

@ -12,39 +12,49 @@
</div>
</template>
<script>
import { mapActions, mapState } from 'vuex';
<script lang="ts">
import { Component, Vue } from 'vue-property-decorator';
import { mapActions } from 'vuex';
import { namespace } from 'vuex-class';
import CandleChart from '@/components/ftbot/CandleChart.vue';
export default {
name: 'Graphs',
components: {
CandleChart,
},
data() {
return {
pair: 'XRP/USDT',
timeframe: '5m',
};
},
computed: {
...mapState('ftbot', ['whitelist', 'history']),
dataset() {
return this.history[`${this.pair}__${this.timeframe}`];
},
const ftbot = namespace('ftbot');
@Component({
components: { CandleChart },
methods: {
...mapActions('ftbot', ['getPairHistory', 'getWhitelist']),
},
})
export default class Graphs extends Vue {
pair = 'XRP/USDT';
timeframe = '5m';
@ftbot.State history;
@ftbot.State whitelist;
@ftbot.Action
public getPairHistory;
@ftbot.Action
public getWhitelist;
mounted() {
this.getWhitelist();
this.refresh();
},
methods: {
...mapActions('ftbot', ['getPairHistory', 'getWhitelist']),
refresh() {
this.getPairHistory({ pair: this.pair, timeframe: this.timeframe, limit: 500 });
},
},
};
}
get dataset() {
return this.history[`${this.pair}__${this.timeframe}`];
}
refresh() {
this.getPairHistory({ pair: this.pair, timeframe: this.timeframe, limit: 500 });
}
}
</script>
<style scoped></style>