|
@@ -3572,14 +3572,17 @@
|
|
|
});
|
|
});
|
|
|
|
|
|
|
|
const trendChartStyle = computed(() => {
|
|
const trendChartStyle = computed(() => {
|
|
|
- const widthN = Math.max(1, Math.floor(trendLabels.value.length / 15));
|
|
|
|
|
- const basePercent = (widthN + 1) * 100 - 100;
|
|
|
|
|
- const widthPercent = tradeTrendQuery.timeDimension === 'YEAR' ? Math.max(220, basePercent) : basePercent;
|
|
|
|
|
- const widthPx = tradeTrendQuery.timeDimension === 'YEAR' ? Math.max(1200, trendLabels.value.length * 420) : 0;
|
|
|
|
|
|
|
+ const labelCount = Math.max(1, trendLabels.value.length);
|
|
|
|
|
+ // 月维度标签是 "YYYY-MM"(7 个字符,约 45px),每个标签至少留 72px,避免数据多时横轴文字重叠;
|
|
|
|
|
+ // 超出容器宽度时由 .qj-trend-scroll 横向滚动承载。
|
|
|
|
|
+ const widthPx =
|
|
|
|
|
+ tradeTrendQuery.timeDimension === 'YEAR'
|
|
|
|
|
+ ? Math.max(1200, labelCount * 420)
|
|
|
|
|
+ : Math.max(1, labelCount * 72);
|
|
|
|
|
|
|
|
return {
|
|
return {
|
|
|
height: '220px',
|
|
height: '220px',
|
|
|
- width: tradeTrendQuery.timeDimension === 'YEAR' ? `${widthPx}px` : `${widthPercent}%`,
|
|
|
|
|
|
|
+ width: `${widthPx}px`,
|
|
|
minWidth: '100%',
|
|
minWidth: '100%',
|
|
|
paddingRight: tradeTrendQuery.timeDimension === 'YEAR' ? '24px' : '0',
|
|
paddingRight: tradeTrendQuery.timeDimension === 'YEAR' ? '24px' : '0',
|
|
|
};
|
|
};
|
|
@@ -4283,6 +4286,8 @@
|
|
|
axisTick: { show: false },
|
|
axisTick: { show: false },
|
|
|
axisLabel: {
|
|
axisLabel: {
|
|
|
interval: 0,
|
|
interval: 0,
|
|
|
|
|
+ // 兜底:极端窄容器或超长标签时自动隐藏重叠标签,宁可少显示也不能叠在一起
|
|
|
|
|
+ hideOverlap: true,
|
|
|
color: '#6b7280',
|
|
color: '#6b7280',
|
|
|
fontSize: 12,
|
|
fontSize: 12,
|
|
|
margin: 16,
|
|
margin: 16,
|