perf: 优化普通折线图legend空间
This commit is contained in:
@@ -43,7 +43,7 @@ const line = {
|
|||||||
grid: {
|
grid: {
|
||||||
left: 55,
|
left: 55,
|
||||||
bottom: 30,
|
bottom: 30,
|
||||||
top: 40,
|
top: 100,
|
||||||
right: 25
|
right: 25
|
||||||
},
|
},
|
||||||
color: chartColor,
|
color: chartColor,
|
||||||
@@ -55,12 +55,13 @@ const line = {
|
|||||||
show: true,
|
show: true,
|
||||||
right: 23,
|
right: 23,
|
||||||
top: 8,
|
top: 8,
|
||||||
|
padding: 2,
|
||||||
orient: 'horizontal',
|
orient: 'horizontal',
|
||||||
icon: 'circle',
|
icon: 'circle',
|
||||||
itemGap: 20,
|
itemGap: 10,
|
||||||
itemWidth: 10,
|
itemWidth: 10,
|
||||||
textStyle: {
|
textStyle: {
|
||||||
padding: [0, 0, 0, 5],
|
padding: [0, 0, 0, 2],
|
||||||
fontSize: 14
|
fontSize: 14
|
||||||
},
|
},
|
||||||
formatter: tooLongFormatter
|
formatter: tooLongFormatter
|
||||||
|
|||||||
@@ -568,6 +568,9 @@ export default {
|
|||||||
data: r.values.map(v => [Number(v[0]) * 1000, Number(v[1]), chartParams.unitType])
|
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) {
|
if (chartParams.unitType === unitTypes.byte) {
|
||||||
this.chartOption.yAxis.axisLabel.formatter = function (value, index, a, b) {
|
this.chartOption.yAxis.axisLabel.formatter = function (value, index, a, b) {
|
||||||
return unitConvert(value, unitTypes.byte).join(' ')
|
return unitConvert(value, unitTypes.byte).join(' ')
|
||||||
|
|||||||
Reference in New Issue
Block a user