data() {
return {
chartOptions: {
rangeSelector: {
verticalAlign: 'bottom',
x: 0,
y: 0,
inputDateFormat: false,
inputPosition: {
align: 'right',
enable: false
},
buttons: [
{
type: 'month',
count: 1,
text: '1',},
{
type: 'month',
count: 3,
text: '3'
},
{
type: 'month',
count: 6,
text: '6'
},
{
type: 'month',
count: 12,
text: '12'
},
{
type: 'all',
text: 'All'
}
]
},
legend: {
enabled: true,
align: 'left',
verticalAlign: 'top'
},
title: {
text: 'Statistic'
},
series: [
{
data: [],
name: 'queries',
color: '#176de6',
tooltip: {
valueDecimals: 2
}
},
{
data: [],
name: 'groups',
color: '#e3e317'
},
{
data: [],
name: 'documents',
color: '#3de617'
},
{
data: [],
name: 'categories',
color: '#e31717'
},
],
navigator: {
series: {
data: []
},
},
}
}
},
computed: {
...mapGetters([
'DATA'
]),
},
methods : {
...mapActions([
'GET_DATA'
]),
setDatas(){
return setTimeout(()=>{
for(let i=0; i<this.request_data.length; i++){
this.chartOptions.series[0].data = Object.values(this.request_data[0])[1].map(e=>e.value)
this.chartOptions.series[1].data = Object.values(this.request_data[1])[1].map(e=>e.value)
this.chartOptions.series[2].data = Object.values(this.request_data[2])[1].map(e=>e.value)
this.chartOptions.series[3].data = Object.values(this.request_data[3])[1].map(e=>e.value)
this.chartOptions.navigator.series.data = Object.values(this.request_data[0])[1].map(e=>new Date(e.date))
}
}, 1000)
},
}
},
created() {
this.GET_DATA()
this.setDatas()
}