|
|
@@ -125,8 +125,22 @@ export function loanStructureOption(d) {
|
|
|
}
|
|
|
|
|
|
// ============== 图4 近1年票据融资额 vs 10年国债(双 Y 轴) ==============
|
|
|
+// 左轴范围按数据取整;右轴下限按 0 点与左轴对齐反推(右轴上限固定 rightMax)
|
|
|
+function alignedAxis(leftVals, step, rightMax) {
|
|
|
+ const vMin = Math.min(0, ...leftVals)
|
|
|
+ const vMax = Math.max(step, ...leftVals)
|
|
|
+ const min = vMin < 0 ? -Math.ceil((-vMin * 1.1) / step) * step : 0
|
|
|
+ const max = Math.ceil((vMax * 1.1) / step) * step
|
|
|
+ const rightMin = min < 0 ? +(((rightMax * min) / max).toFixed(2)) : 0
|
|
|
+ return { min, max, rightMin }
|
|
|
+}
|
|
|
+
|
|
|
+// 右轴标签格式化:消除 alignTicks 带来的浮点漂移(如 -0.003 → 0)
|
|
|
+const pctLabel = { color: C.mut, fontSize: 11, formatter: (v) => String(+v.toFixed(2)) }
|
|
|
+
|
|
|
export function billVsBond10Option(d) {
|
|
|
const cats = (d.categories || []).map((x) => String(x).slice(2, 7))
|
|
|
+ const ax = alignedAxis(d.bill12m || [], 5000, 5)
|
|
|
return {
|
|
|
tooltip: { ...tipOpt, trigger: 'axis' },
|
|
|
legend: {
|
|
|
@@ -141,12 +155,13 @@ export function billVsBond10Option(d) {
|
|
|
yAxis: [
|
|
|
{
|
|
|
type: 'value', name: '亿元', position: 'left',
|
|
|
+ min: ax.min, max: ax.max,
|
|
|
...axisStyle({ nameTextStyle: { color: C.mut, fontSize: 10 }, nameGap: 14 }),
|
|
|
},
|
|
|
{
|
|
|
type: 'value', name: '%', position: 'right',
|
|
|
- min: 0, max: 5,
|
|
|
- ...axisStyle({ nameTextStyle: { color: C.mut, fontSize: 10 }, nameGap: 14 }),
|
|
|
+ min: ax.rightMin, max: 5, alignTicks: true,
|
|
|
+ ...axisStyle({ nameTextStyle: { color: C.mut, fontSize: 10 }, nameGap: 14, axisLabel: pctLabel }),
|
|
|
},
|
|
|
],
|
|
|
series: [
|
|
|
@@ -179,6 +194,7 @@ export function billVsBond10Option(d) {
|
|
|
// ============== 图5 M1 同比 vs 10年国债(双 Y 轴) ==============
|
|
|
export function m1VsBond10Option(d) {
|
|
|
const cats = (d.categories || []).map((x) => String(x).slice(2, 7))
|
|
|
+ const ax = alignedAxis(d.m1Yoy || [], 5, 5)
|
|
|
return {
|
|
|
tooltip: { ...tipOpt, trigger: 'axis' },
|
|
|
legend: {
|
|
|
@@ -190,12 +206,13 @@ export function m1VsBond10Option(d) {
|
|
|
yAxis: [
|
|
|
{
|
|
|
type: 'value', name: '%', position: 'left',
|
|
|
+ min: ax.min, max: ax.max,
|
|
|
...axisStyle({ nameTextStyle: { color: C.mut, fontSize: 10 }, nameGap: 14 }),
|
|
|
},
|
|
|
{
|
|
|
type: 'value', name: '%', position: 'right',
|
|
|
- min: 0, max: 5,
|
|
|
- ...axisStyle({ nameTextStyle: { color: C.mut, fontSize: 10 }, nameGap: 14 }),
|
|
|
+ min: ax.rightMin, max: 5, alignTicks: true,
|
|
|
+ ...axisStyle({ nameTextStyle: { color: C.mut, fontSize: 10 }, nameGap: 14, axisLabel: pctLabel }),
|
|
|
},
|
|
|
],
|
|
|
series: [
|