<div id="main" style=" 37.5rem;height: 25rem;"></div>
<script>
var myChart = echarts.init(document.getElementById("main"), 'light');
$(function () {
$.ajax({
url: '/post/console.do',
type: 'post',
dataType: 'json',
success: function (e) {
$("#count1").text(e.userCount);
$("#count2").text(e.userRegCount);
$("#count3").text(e.galleryCount);
$("#count4").text(e.galleryUploadCount);
var option = {
title: {
text: '论坛发帖统计'
},
tooltip: {
trigger: 'item',
formatter: function (params) {
var date = new Date(params.value[0]);
date = date.getFullYear() + '-' +
(date.getMonth() + 1) + '-' +
date.getDate();
return date + '<br/>' +
params.value[1];
}
},
dataZoom: {
show: true,
start: 70
},
legend: {
data: ['论坛发帖统计']
},
grid: {
y2: 80
},
xAxis: [{
type: 'time',
splitNumber: 10
}],
yAxis: [{
type: 'value'
}],
series: [
{
name: '论坛发帖统计',
type: 'line',
data: (function () {
var arr = e.echarts;
var d = [];
for (var i in arr) {
d.push([new Date(arr[i].dateTime), arr[i].countNumber])
}
return d;
})()
}
]
};
myChart.setOption(option);
}
})
})
</script>