Answer the question
In order to leave comments, you need to log in
Chart with Axios?
How can I use axios to substitute data into the chart array?
Here's what's available
<template lang="pug">
include ../../../node_modules/bemto.pug/bemto.pug
- set_bemto_settings({ prefix: 'b-' })
div
+b.DIV.select-container-filial
+b.SELECT.select-filials(v-model="selectedFilial")
+e.OPTION.filial(value="" selected disabled hidden) Выберите филиал
+e.OPTION.filial(v-for="filial in filials" v-bind:value="filial.f5001") {{filial.f5001}}
+e.BUTTON(@click="reset()").clear Сброс
line-chart(class="user_chart" :data="chartData" width="450px" height="270px" xtitle="Месяц" ytitle="Сумма" :legend="true" legend="right" :colors="['#4DB6AC', '#7986CB', '#81C784']")
</template>
<script>
require('./chart-zayavka.styl')
import axios from 'axios'
export default {
data: function(){
return{
chartData:[
{name: 'name',
data: {"Jan": 3745, "Feb": 4578, "Mar": 10785, "Apr": 5585, "May": 32533, "Jun": 77872, "Jul": 21455, "Aug": 52585, "Sep": 12588, "Oct": 22555, "Nov": 87585, "Dec":68522}},
{name: 'name',
data: {"Jan": 42525, "Feb": 78278, "Mar": 10785, "Apr": 25827, "May": 74585, "Jun":78585, "Jul": 85282, "Aug": 25258, "Sep": 82828, "Oct": 25288, "Nov": 21582, "Dec":68522}},
{name: 'name',
data: {"Jan": 44255, "Feb": 75278, "Mar": 10255, "Apr": 22877, "May": 15855, "Jun":88525, "Jul": 77852, "Aug": 25214, "Sep": 42258, "Oct": 25258, "Nov": 72142, "Dec":52788}},
],
filials: [],
selectedFilial:''
}
},
mounted(){
var CancelToken = axios.CancelToken;
var source = CancelToken.source();
axios.post('/filials', {
_csrf: document.querySelector('meta[name="csrf-token"]').getAttribute('content')
}).then(data => {
this.filials = data.data;
});
},
methods:{
reset(){
console.log('reset');
this.selectedFilial = '';
}
}
}
</script>
Answer the question
In order to leave comments, you need to log in
How can I use axios to substitute data into the chart array?
Didn't find what you were looking for?
Ask your questionAsk a Question
731 491 924 answers to any question