# up total-history linechart
This commit is contained in:
parent
13cfaeba7b
commit
076c486cf4
|
@ -72,7 +72,7 @@ export default {
|
||||||
}
|
}
|
||||||
},
|
},
|
||||||
methods: {
|
methods: {
|
||||||
setOptions({ expectedData, actualData } = {}) {
|
setOptions({ totalHistoryData, actualData } = {}) {
|
||||||
this.chart.setOption({
|
this.chart.setOption({
|
||||||
xAxis: {
|
xAxis: {
|
||||||
data: ['Mon', 'Tue', 'Wed', 'Thu', 'Fri', 'Sat', 'Sun'],
|
data: ['Mon', 'Tue', 'Wed', 'Thu', 'Fri', 'Sat', 'Sun'],
|
||||||
|
@ -101,10 +101,10 @@ export default {
|
||||||
}
|
}
|
||||||
},
|
},
|
||||||
legend: {
|
legend: {
|
||||||
data: ['expected', 'actual']
|
data: ['Total', 'Increment']
|
||||||
},
|
},
|
||||||
series: [{
|
series: [{
|
||||||
name: 'expected', itemStyle: {
|
name: 'Total', itemStyle: {
|
||||||
normal: {
|
normal: {
|
||||||
color: '#FF005A',
|
color: '#FF005A',
|
||||||
lineStyle: {
|
lineStyle: {
|
||||||
|
@ -115,12 +115,12 @@ export default {
|
||||||
},
|
},
|
||||||
smooth: true,
|
smooth: true,
|
||||||
type: 'line',
|
type: 'line',
|
||||||
data: expectedData,
|
data: totalHistoryData,
|
||||||
animationDuration: 2800,
|
animationDuration: 2800,
|
||||||
animationEasing: 'cubicInOut'
|
animationEasing: 'cubicInOut'
|
||||||
},
|
},
|
||||||
{
|
{
|
||||||
name: 'actual',
|
name: 'Increment',
|
||||||
smooth: true,
|
smooth: true,
|
||||||
type: 'line',
|
type: 'line',
|
||||||
itemStyle: {
|
itemStyle: {
|
||||||
|
@ -143,7 +143,7 @@ export default {
|
||||||
},
|
},
|
||||||
initChart() {
|
initChart() {
|
||||||
this.chart = echarts.init(this.$el, 'macarons')
|
this.chart = echarts.init(this.$el, 'macarons')
|
||||||
this.setOptions(this.chartData)
|
// this.setOptions(this.chartData)
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
|
@ -41,7 +41,7 @@ export default {
|
||||||
item.oid = index + 1
|
item.oid = index + 1
|
||||||
})
|
})
|
||||||
this.listLoading = false
|
this.listLoading = false
|
||||||
// console.log(this.historyList)
|
this.$emit('history', this.historyList)
|
||||||
})
|
})
|
||||||
}
|
}
|
||||||
},
|
},
|
||||||
|
|
|
@ -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('newVisitis')">
|
<div class='card-panel' @click="handleSetLineChartData('historyData')">
|
||||||
<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>
|
||||||
|
|
|
@ -16,7 +16,9 @@
|
||||||
</el-row>
|
</el-row>
|
||||||
|
|
||||||
<el-row>
|
<el-row>
|
||||||
<log-history-table :historyList="historyList"></log-history-table>
|
<log-history-table
|
||||||
|
@history="handleHistoryLine"
|
||||||
|
></log-history-table>
|
||||||
</el-row>
|
</el-row>
|
||||||
|
|
||||||
<!-- <el-row :gutter="32">
|
<!-- <el-row :gutter="32">
|
||||||
|
@ -67,12 +69,12 @@ import
|
||||||
{
|
{
|
||||||
fetchDeviceLogStatistic,
|
fetchDeviceLogStatistic,
|
||||||
fetchDeviceInfoStatistic
|
fetchDeviceInfoStatistic
|
||||||
|
// fetchLogStatisticHistory
|
||||||
} from '@/api/counter'
|
} from '@/api/counter'
|
||||||
|
|
||||||
const lineChartData = {
|
const lineChartData = {
|
||||||
newVisitis: {
|
historyData: {
|
||||||
expectedData: [100, 120, 161, 134, 105, 160, 165],
|
totalHistoryData: []
|
||||||
actualData: [120, 82, 91, 154, 162, 140, 145]
|
|
||||||
},
|
},
|
||||||
messages: {
|
messages: {
|
||||||
expectedData: [200, 192, 120, 144, 160, 130, 140],
|
expectedData: [200, 192, 120, 144, 160, 130, 140],
|
||||||
|
@ -104,13 +106,12 @@ export default {
|
||||||
},
|
},
|
||||||
data() {
|
data() {
|
||||||
return {
|
return {
|
||||||
lineChartData: lineChartData.newVisitis,
|
lineChartData: lineChartData.historyData,
|
||||||
totalCount: 0,
|
totalCount: 0,
|
||||||
dailyCount: 0,
|
dailyCount: 0,
|
||||||
onlineCount: 0,
|
onlineCount: 0,
|
||||||
offlineCount: 0,
|
offlineCount: 0,
|
||||||
historyList: [],
|
historyList: []
|
||||||
historyLoading: true
|
|
||||||
}
|
}
|
||||||
},
|
},
|
||||||
methods: {
|
methods: {
|
||||||
|
@ -130,11 +131,30 @@ export default {
|
||||||
this.totalCount = logData['total_count']
|
this.totalCount = logData['total_count']
|
||||||
this.dailyCount = logData['daily_count']
|
this.dailyCount = logData['daily_count']
|
||||||
})
|
})
|
||||||
|
},
|
||||||
|
handleHistoryLine(historyList) {
|
||||||
|
var totalList = []
|
||||||
|
historyList.forEach((item, index) => {
|
||||||
|
totalList.push(item.total)
|
||||||
|
})
|
||||||
|
this.lineChartData.totalHistoryData = totalList.reverse()
|
||||||
|
// console.log(this.lineChartData.totalHistoryData)
|
||||||
}
|
}
|
||||||
|
// 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