# up increment, total chart
This commit is contained in:
parent
d89fb84047
commit
8f03176d42
|
@ -27,9 +27,6 @@ export default {
|
||||||
},
|
},
|
||||||
chartData: {
|
chartData: {
|
||||||
type: Object
|
type: Object
|
||||||
},
|
|
||||||
xAxis: {
|
|
||||||
type: Array
|
|
||||||
}
|
}
|
||||||
},
|
},
|
||||||
data() {
|
data() {
|
||||||
|
@ -75,11 +72,11 @@ export default {
|
||||||
}
|
}
|
||||||
},
|
},
|
||||||
methods: {
|
methods: {
|
||||||
setOptions({ totalHistoryData, actualData } = {}) {
|
setOptions({ historyData, xAxis, title } = {}) {
|
||||||
this.chart.setOption({
|
this.chart.setOption({
|
||||||
xAxis: {
|
xAxis: {
|
||||||
// data: ['Mon', 'Tue', 'Wed', 'Thu', 'Fri', 'Sat', 'Sun'],
|
// data: ['Mon', 'Tue', 'Wed', 'Thu', 'Fri', 'Sat', 'Sun'],
|
||||||
data: this.xAxis,
|
data: xAxis,
|
||||||
boundaryGap: false,
|
boundaryGap: false,
|
||||||
axisLabel: {
|
axisLabel: {
|
||||||
interval: 0
|
interval: 0
|
||||||
|
@ -108,10 +105,10 @@ export default {
|
||||||
}
|
}
|
||||||
},
|
},
|
||||||
legend: {
|
legend: {
|
||||||
data: ['Total', 'Increment']
|
data: [title]
|
||||||
},
|
},
|
||||||
series: [{
|
series: [{
|
||||||
name: 'Total', itemStyle: {
|
name: title, itemStyle: {
|
||||||
normal: {
|
normal: {
|
||||||
color: '#FF005A',
|
color: '#FF005A',
|
||||||
lineStyle: {
|
lineStyle: {
|
||||||
|
@ -122,29 +119,9 @@ export default {
|
||||||
},
|
},
|
||||||
smooth: true,
|
smooth: true,
|
||||||
type: 'line',
|
type: 'line',
|
||||||
data: totalHistoryData,
|
data: historyData,
|
||||||
animationDuration: 2800,
|
animationDuration: 2800,
|
||||||
animationEasing: 'cubicInOut'
|
animationEasing: 'cubicInOut'
|
||||||
},
|
|
||||||
{
|
|
||||||
name: 'Increment',
|
|
||||||
smooth: true,
|
|
||||||
type: 'line',
|
|
||||||
itemStyle: {
|
|
||||||
normal: {
|
|
||||||
color: '#3888fa',
|
|
||||||
lineStyle: {
|
|
||||||
color: '#3888fa',
|
|
||||||
width: 2
|
|
||||||
},
|
|
||||||
areaStyle: {
|
|
||||||
color: '#f3f8ff'
|
|
||||||
}
|
|
||||||
}
|
|
||||||
},
|
|
||||||
data: actualData,
|
|
||||||
animationDuration: 2800,
|
|
||||||
animationEasing: 'quadraticOut'
|
|
||||||
}]
|
}]
|
||||||
})
|
})
|
||||||
},
|
},
|
||||||
|
|
|
@ -1,7 +1,7 @@
|
||||||
<template>
|
<template>
|
||||||
<el-row class="panel-group" :gutter="40">
|
<el-row class="panel-group" :gutter="40">
|
||||||
<el-col :xs="12" :sm="12" :lg="6" class="card-panel-col">
|
<el-col :xs="12" :sm="12" :lg="6" class="card-panel-col">
|
||||||
<div class='card-panel' @click="handleSetLineChartData('historyData')">
|
<div class='card-panel' @click="handleSetLineChartData('total')">
|
||||||
<div class="card-panel-icon-wrapper icon-plus">
|
<div class="card-panel-icon-wrapper icon-plus">
|
||||||
<svg-icon icon-class="plus" class-name="card-panel-icon" />
|
<svg-icon icon-class="plus" class-name="card-panel-icon" />
|
||||||
</div>
|
</div>
|
||||||
|
@ -12,7 +12,7 @@
|
||||||
</div>
|
</div>
|
||||||
</el-col>
|
</el-col>
|
||||||
<el-col :xs="12" :sm="12" :lg="6" class="card-panel-col">
|
<el-col :xs="12" :sm="12" :lg="6" class="card-panel-col">
|
||||||
<div class="card-panel" @click="handleSetLineChartData('messages')">
|
<div class="card-panel" @click="handleSetLineChartData('increment')">
|
||||||
<div class="card-panel-icon-wrapper icon-rise">
|
<div class="card-panel-icon-wrapper icon-rise">
|
||||||
<svg-icon icon-class="rise" class-name="card-panel-icon" />
|
<svg-icon icon-class="rise" class-name="card-panel-icon" />
|
||||||
</div>
|
</div>
|
||||||
|
@ -23,7 +23,7 @@
|
||||||
</div>
|
</div>
|
||||||
</el-col>
|
</el-col>
|
||||||
<el-col :xs="12" :sm="12" :lg="6" class="card-panel-col">
|
<el-col :xs="12" :sm="12" :lg="6" class="card-panel-col">
|
||||||
<div class="card-panel" @click="handleSetLineChartData('purchases')">
|
<div class="card-panel" @click="">
|
||||||
<div class="card-panel-icon-wrapper icon-online">
|
<div class="card-panel-icon-wrapper icon-online">
|
||||||
<svg-icon icon-class="online" class-name="card-panel-icon" />
|
<svg-icon icon-class="online" class-name="card-panel-icon" />
|
||||||
</div>
|
</div>
|
||||||
|
@ -34,7 +34,7 @@
|
||||||
</div>
|
</div>
|
||||||
</el-col>
|
</el-col>
|
||||||
<el-col :xs="12" :sm="12" :lg="6" class="card-panel-col">
|
<el-col :xs="12" :sm="12" :lg="6" class="card-panel-col">
|
||||||
<div class="card-panel" @click="handleSetLineChartData('shoppings')">
|
<div class="card-panel" @click="">
|
||||||
<div class="card-panel-icon-wrapper icon-offline">
|
<div class="card-panel-icon-wrapper icon-offline">
|
||||||
<svg-icon icon-class="offline" class-name="card-panel-icon" />
|
<svg-icon icon-class="offline" class-name="card-panel-icon" />
|
||||||
</div>
|
</div>
|
||||||
|
|
|
@ -12,7 +12,7 @@
|
||||||
</panel-group>
|
</panel-group>
|
||||||
|
|
||||||
<el-row style="background:#fff;padding:16px 16px 0;margin-bottom:32px;">
|
<el-row style="background:#fff;padding:16px 16px 0;margin-bottom:32px;">
|
||||||
<line-chart :chart-data="lineChartData" :xAxis="this.lineChartData.xAxis"></line-chart>
|
<line-chart :chart-data="lineChartData"></line-chart>
|
||||||
</el-row>
|
</el-row>
|
||||||
|
|
||||||
<el-row>
|
<el-row>
|
||||||
|
@ -73,22 +73,15 @@ import
|
||||||
} from '@/api/counter'
|
} from '@/api/counter'
|
||||||
|
|
||||||
const lineChartData = {
|
const lineChartData = {
|
||||||
historyData: {
|
total: {
|
||||||
totalHistoryData: [],
|
historyData: [],
|
||||||
incrementHistoryData: [],
|
xAxis: [],
|
||||||
xAxis: []
|
title: 'Total'
|
||||||
},
|
},
|
||||||
messages: {
|
increment: {
|
||||||
totalHistoryData: [200, 192, 120, 144, 160, 130, 140],
|
historyData: [],
|
||||||
incrementHistoryData: [],
|
xAxis: [],
|
||||||
xAxis: [1, 2, 3, 4, 5, 6, 7]
|
title: 'Increment'
|
||||||
},
|
|
||||||
purchases: {
|
|
||||||
totalHistoryData: [80, 100, 121, 104, 105, 90, 100]
|
|
||||||
},
|
|
||||||
shoppings: {
|
|
||||||
totalHistoryData: [130, 140, 141, 142, 145, 150, 160],
|
|
||||||
actualData: [120, 82, 91, 154, 162, 140, 130]
|
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -108,7 +101,7 @@ export default {
|
||||||
},
|
},
|
||||||
data() {
|
data() {
|
||||||
return {
|
return {
|
||||||
lineChartData: lineChartData.historyData,
|
lineChartData: lineChartData.total,
|
||||||
totalCount: 0,
|
totalCount: 0,
|
||||||
dailyCount: 0,
|
dailyCount: 0,
|
||||||
onlineCount: 0,
|
onlineCount: 0,
|
||||||
|
@ -135,31 +128,24 @@ export default {
|
||||||
})
|
})
|
||||||
},
|
},
|
||||||
handleHistoryLine(historyList) {
|
handleHistoryLine(historyList) {
|
||||||
var totalList = []
|
const totalList = []
|
||||||
var dateList = []
|
const incrementList = []
|
||||||
|
const dateList = []
|
||||||
|
console.log(historyList)
|
||||||
historyList.forEach((item, index) => {
|
historyList.forEach((item, index) => {
|
||||||
totalList.push(item.total)
|
totalList.push(item.total)
|
||||||
|
incrementList.push(item.increment)
|
||||||
dateList.push(item.date.substr(5))
|
dateList.push(item.date.substr(5))
|
||||||
})
|
})
|
||||||
this.lineChartData.totalHistoryData = totalList.reverse()
|
lineChartData.total.historyData = totalList.reverse()
|
||||||
this.lineChartData.xAxis = dateList.reverse()
|
lineChartData.increment.historyData = incrementList.reverse()
|
||||||
// console.log(this.lineChartData.totalHistoryData)
|
lineChartData.total.xAxis = dateList.reverse()
|
||||||
|
lineChartData.increment.xAxis = dateList
|
||||||
}
|
}
|
||||||
// getLogStatisticHistory() {
|
|
||||||
// fetchLogStatisticHistory().then(response => {
|
|
||||||
// var totalList = []
|
|
||||||
// this.historyList = response.data.results
|
|
||||||
// this.historyList.forEach((item, index) => {
|
|
||||||
// totalList.push(item.total)
|
|
||||||
// })
|
|
||||||
// this.lineChartData.totalHistoryData = totalList
|
|
||||||
// })
|
|
||||||
// }
|
|
||||||
},
|
},
|
||||||
created() {
|
created() {
|
||||||
this.getDeviceInfoStatistic()
|
this.getDeviceInfoStatistic()
|
||||||
this.getDeviceLogStatistic()
|
this.getDeviceLogStatistic()
|
||||||
// this.getLogStatisticHistory()
|
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
</script>
|
</script>
|
||||||
|
|
Loading…
Reference in New Issue