|
|
@ -37,6 +37,27 @@ function DataTop5(props) { |
|
|
|
show: false, |
|
|
|
}, |
|
|
|
}, |
|
|
|
tooltip: { |
|
|
|
confine: true, |
|
|
|
trigger: 'axis', |
|
|
|
axisPointer: { |
|
|
|
type: 'shadow', |
|
|
|
}, |
|
|
|
backgroundColor: 'rgba(13,30,44, 0.7)', |
|
|
|
borderColor: 'rgba(3, 65, 118, 0.8)', |
|
|
|
textStyle: { |
|
|
|
color: '#fff', |
|
|
|
}, |
|
|
|
formatter: function (params) { |
|
|
|
var name = params[0].name |
|
|
|
if (name.length > 20) { |
|
|
|
name = name.replace(/(.{20})/g, '$1<br>') // 每 30 个字符添加一个换行符
|
|
|
|
} |
|
|
|
var content = name |
|
|
|
|
|
|
|
return content + ' : <b>' + params[0].value + '</b>万条' |
|
|
|
} |
|
|
|
}, |
|
|
|
grid: { |
|
|
|
top: 13, |
|
|
|
bottom: -10, |
|
|
@ -57,14 +78,15 @@ function DataTop5(props) { |
|
|
|
}, |
|
|
|
formatter(value, index) { |
|
|
|
let str = '', num = 'TOP' + (index + 1) |
|
|
|
let valueHandle = value.length > 10 ? value.substring(0, 10) + '...' : value |
|
|
|
if (index === 0) { |
|
|
|
str = '{a| ' + num + '}{title| ' + value + '}' |
|
|
|
str = '{a| ' + num + '}{title| ' + valueHandle + '}' |
|
|
|
} else if (index === 1) { |
|
|
|
str = '{b| ' + num + '}{title| ' + value + '}' |
|
|
|
str = '{b| ' + num + '}{title| ' + valueHandle + '}' |
|
|
|
} else if (index === 2) { |
|
|
|
str = '{c| ' + num + '}{title| ' + value + '}' |
|
|
|
str = '{c| ' + num + '}{title| ' + valueHandle + '}' |
|
|
|
} else { |
|
|
|
str = '{d| ' + num + '}{title| ' + value + '}' |
|
|
|
str = '{d| ' + num + '}{title| ' + valueHandle + '}' |
|
|
|
} |
|
|
|
return str |
|
|
|
}, |
|
|
|