// var ajaxUrl = 'http://192.168.99.107:7070'
var ajaxUrl = 'http://192.168.1.100:7070'
var chartDom2 = document.getElementById('chart2');
var myChart2 = echarts.init(chartDom2);
var option2;
var typeData = []
var echartsTimer = null
// 每隔一分钟刷新档案借阅和档案类型的数据
echartsTimer = setInterval(() => {
typeData = []
option2.series[0].data = typeData
FetchInitArchivesTypeStatistics()
myChart2.setOption(option2)
}, 60000)
option2 = {
tooltip: {
// trigger: 'item',
// formatter: '{a}
{b} : {c} ({d}%)'
},
legend: {
bottom: 20,
left: 'center',
icon: 'rect',
itemHeight: 14,
itemWidth: 14,
textStyle: {
color: '#fff'
}
},
series: [
{
name: '档案类型',
type: 'pie',
radius: ['20%', '60%'],
center: ['50%', '35%'], // 饼图位置
roseType: 'area',
avoidLabelOverlap: true,
labelLine: {
normal: {
length: 2, // 第一段表示线
length2: 60 // 第二段标示线
}
},
itemStyle: {
normal: {
label: {
show: true,
color: '#fff',
formatter: '{d}%' // 指示线显示百分比
}
}
},
emphasis: {
label: {
show: false
}
},
data: []
}
]
};
option2 && myChart2.setOption(option2);
FetchInitArchivesTypeStatistics()
function FetchInitArchivesTypeStatistics(){
$.ajax({
url: ajaxUrl + '/api/archives/initArchivesTypeStatistics',
type: 'GET',
data: {},
success: function (res) {
if (res.data && res.data.length !== 0) {
res.data.map(item => {
const obj = {}
obj.name = item.archivesType
obj.value = item.archivesNum
typeData.push(obj)
})
option2.series[0].data = typeData
myChart2.setOption(option2)
} else {
var str = '
暂无数据
' +'