v1.21.0 x轴标签可读性:新增 xLabelRotate 旋转角度/xLabelInterval 标签间隔/xLabelFontSize 字号 三个图表选项,模型对比图底部横轴字多时可旋转/加间隔避免挤压

This commit is contained in:
2026-09-02 13:59:49 +08:00
parent 01c0536986
commit 32db3644b8
+8 -3
View File
@@ -193,6 +193,9 @@ function buildChartOption(params) {
leftAxisMax = '',
rightAxisMin = '',
rightAxisMax = '',
xLabelRotate = '',
xLabelInterval = '',
xLabelFontSize = 0,
width = 800
} = params;
@@ -476,9 +479,11 @@ function buildChartOption(params) {
axisLine: { lineStyle: { color: axisLineColor } },
axisLabel: {
color: textColor,
fontSize: 12,
interval: 0,
rotate: parsedData.categories.length > 10 ? 30 : 0
fontSize: xLabelFontSize > 0 ? xLabelFontSize : 12,
interval: xLabelInterval === '' ? 0 : Number(xLabelInterval),
rotate: xLabelRotate === ''
? (parsedData.categories.length > 10 ? 30 : 0)
: Number(xLabelRotate)
},
axisTick: { show: false }
},