perf: 优化普通折线图legend空间

This commit is contained in:
chenjinsong
2021-08-16 18:36:13 +08:00
parent 03a14e3f40
commit 0610c95a10
2 changed files with 7 additions and 3 deletions

View File

@@ -568,6 +568,9 @@ export default {
data: r.values.map(v => [Number(v[0]) * 1000, Number(v[1]), chartParams.unitType])
}
})
const rows = (response.data.result.length - 1) / 4 + 1 // 根据legend个数动态预留legend空间
const gridTop = 10 + 27 * rows
this.chartOption.grid.top = gridTop
if (chartParams.unitType === unitTypes.byte) {
this.chartOption.yAxis.axisLabel.formatter = function (value, index, a, b) {
return unitConvert(value, unitTypes.byte).join(' ')