Commit 653fcc8e authored by ganjingcun's avatar ganjingcun

曲线图数据

parent da155a88
......@@ -201,8 +201,45 @@
methods: {
drawLine() {
// 基于准备好的dom,初始化echarts实例
let myChart = this.$echarts.init(document.getElementById('myChart'))
// 绘制图表
this.myChart = this.$echarts.init(document.getElementById('myChart'))
},
searchTextChange: function () {
var username = this.username
this.renderTable()
},
selectChange: function (val) {
this.type = val
this.renderTable()
},
init: function (lang) {
this.renderTable()
},
clickpage: function (num) {
this.page = num
this.renderTable()
},
formatter0(row, column) {
if ('athletic' === row.type) {
return '竞技'
} else {
return '娱乐'
}
},
formatter1(row, column) {
return moment(row.start_time).format('YYYY-MM-DD HH:mm')
},
formatter2(row, column) {
return moment(row.end_time).format('YYYY-MM-DD HH:mm')
},
renderTable: function () {
var params = {
from_date: this.from_date,
to_date: this.to_date
}
var _this = this;
API.getReport(params).then((res) => {
_this.report = res.data
console.log(_this.report)
var colors = ['#5793f3', '#d14a61', '#675bba'];
......@@ -244,7 +281,7 @@
}
}
},
data: ["2016-1", "2016-2", "2016-3", "2016-4", "2016-5", "2016-6", "2016-7", "2016-8", "2016-9", "2016-10", "2016-11", "2016-12"]
data: Object.keys(_this.report.hourlyDataMap.entertain)
},
{
type: 'category',
......@@ -265,7 +302,7 @@
}
}
},
data: ["2015-1", "2015-2", "2015-3", "2015-4", "2015-5", "2015-6", "2015-7", "2015-8", "2015-9", "2015-10", "2015-11", "2015-12"]
data: Object.keys(_this.report.hourlyDataMap.athletic)
}
],
yAxis: [
......@@ -279,56 +316,19 @@
type: 'line',
xAxisIndex: 1,
smooth: true,
data: [2.6, 5.9, 9.0, 26.4, 1111.7, 70.7, 175.6, 182.2, 48.7, 18.8, 6.0, 2.3]
data: Object.values(_this.report.hourlyDataMap.athletic)
},
{
name: '娱乐场',
type: 'line',
smooth: true,
data: [3.9, 5.9, 11.1, 18.7, 48.3, 69.2, 231.6, 46.6, 55.4, 18.4, 10.3, 0.7]
data: Object.values(_this.report.hourlyDataMap.entertain)
}
]
};
myChart.setOption(option);
},
searchTextChange: function () {
var username = this.username
this.renderTable()
},
selectChange: function (val) {
this.type = val
this.renderTable()
},
init: function (lang) {
this.renderTable()
},
clickpage: function (num) {
this.page = num
this.renderTable()
},
formatter0(row, column) {
if ('athletic' === row.type) {
return '竞技'
} else {
return '娱乐'
}
},
formatter1(row, column) {
return moment(row.start_time).format('YYYY-MM-DD HH:mm')
},
formatter2(row, column) {
return moment(row.end_time).format('YYYY-MM-DD HH:mm')
},
renderTable: function () {
var params = {
from_date: this.from_date,
to_date: this.to_date
}
var _this = this;
API.getReport(params).then((res) => {
_this.report = res.data
console.log(_this.report)
_this.myChart.setOption(option);
}, (res) => {
//
})
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment