|
117 | 117 | return cache1; |
118 | 118 | } |
119 | 119 |
|
120 | | - const cache2 = { key: '', xLo: 0, xHi: 0, maxDotGumbel: null, maxDotBeta: null, singlePair: null }; |
| 120 | + const cache2 = { key: '', xLo: 0, xHi: 0, maxDotGumbel: null, maxDotBeta: null, singlePair: null, probPair: null, probMax: null }; |
121 | 121 | function theoryData2() { |
122 | 122 | const { N, K, twoSided } = state; |
123 | 123 | const key = N + '|' + K + '|' + twoSided; |
|
136 | 136 | const maxDotGumbel = []; |
137 | 137 | const maxDotBeta = []; |
138 | 138 | const singlePair = []; |
| 139 | + const probPair = []; |
| 140 | + const probMax = []; |
139 | 141 | for (let i = 0; i <= samples; i++) { |
140 | 142 | const r = xLo + (i / samples) * (xHi - xLo); |
141 | 143 | maxDotGumbel.push([r, T.maxDotDensity(r, N, K, twoSided)]); |
142 | 144 | maxDotBeta.push([r, T.maxDotDensityBeta(r, N, K, twoSided)]); |
143 | 145 | // 双侧模式下对比基线应为单个 |ρ| 的密度:负半轴折叠到正半轴,高度翻倍 |
144 | 146 | const g = T.pairDotDensity(r, N); |
145 | 147 | singlePair.push([r, twoSided ? 2 * g : g]); |
| 148 | + // 右轴近似正交概率:始终按 |ρ|(双侧)口径,与单双侧开关无关; |
| 149 | + // r ≤ 0 时概率为 0(保持网格一致,axis tip 负半段也能显示该系列) |
| 150 | + probPair.push([r, r > 0 ? T.pairAbsDotCDF(r, N) : 0]); |
| 151 | + probMax.push([r, r > 0 ? T.maxDotCDFBeta(r, N, K, true) : 0]); |
146 | 152 | } |
147 | 153 | cache2.key = key; |
148 | 154 | cache2.xLo = xLo; |
|
152 | 158 | cache2.maxDotGumbel = maxDotGumbel; |
153 | 159 | cache2.maxDotBeta = maxDotBeta; |
154 | 160 | cache2.singlePair = singlePair; |
| 161 | + cache2.probPair = probPair; |
| 162 | + cache2.probMax = probMax; |
155 | 163 | return cache2; |
156 | 164 | } |
157 | 165 |
|
|
673 | 681 | left: 'center', |
674 | 682 | textStyle: { fontSize: 14 }, |
675 | 683 | }, |
676 | | - // 系列顺序:F^M(蓝)、Gumbel(黄)、单对(绿) |
| 684 | + // 系列顺序:F^M(蓝)、Gumbel(黄)、单对(绿);两条正交概率曲线自带显式配色 |
677 | 685 | color: ['#2563eb', '#eab308', '#2ca02c'], |
678 | 686 | tooltip: { |
679 | 687 | trigger: 'axis', |
|
683 | 691 | let html = |
684 | 692 | 'ρ = ' + rho.toFixed(4) + '(θ≈' + rhoToDeg(rho).toFixed(2) + '°)'; |
685 | 693 | for (const p of params) { |
| 694 | + const v = Number(p.value[1]); |
| 695 | + if (!isFinite(v)) continue; |
| 696 | + // 正交概率曲线在右轴(0~1),按百分比显示 |
| 697 | + const isProb = p.seriesName.indexOf('正交概率') >= 0; |
686 | 698 | html += |
687 | 699 | '<br/>' + p.marker + p.seriesName + ':' + |
688 | | - Number(p.value[1]).toFixed(3); |
| 700 | + (isProb ? (v * 100).toFixed(2) + '%' : v.toFixed(3)); |
689 | 701 | } |
690 | 702 | return html; |
691 | 703 | }, |
692 | 704 | }, |
693 | | - legend: { bottom: 0 }, |
694 | | - grid: { left: 60, right: 30, top: 45, bottom: 45 }, |
| 705 | + legend: { bottom: 0, type: 'scroll' }, |
| 706 | + // 右侧概率轴占位:right 由 30 加宽到 56 |
| 707 | + grid: { left: 60, right: 56, top: 45, bottom: 45 }, |
695 | 708 | xAxis: [ |
696 | 709 | { |
697 | 710 | type: 'value', |
|
724 | 737 | }, |
725 | 738 | ], |
726 | 739 | // 轴名放中部:顶部要留给角度副轴的 90° 端点标签 |
727 | | - yAxis: { type: 'value', name: '密度', nameLocation: 'middle', nameGap: 40, min: 0 }, |
| 740 | + yAxis: [ |
| 741 | + { type: 'value', name: '密度', nameLocation: 'middle', nameGap: 40, min: 0 }, |
| 742 | + // 右侧概率轴(0~1):近似正交概率曲线专用 |
| 743 | + { |
| 744 | + type: 'value', |
| 745 | + name: '概率', |
| 746 | + nameLocation: 'middle', |
| 747 | + nameGap: 32, |
| 748 | + position: 'right', |
| 749 | + min: 0, |
| 750 | + max: 1, |
| 751 | + splitLine: { show: false }, |
| 752 | + axisLabel: { formatter: (v) => String(Number(v.toFixed(1))) }, |
| 753 | + }, |
| 754 | + ], |
728 | 755 | series: [ |
729 | 756 | { |
730 | 757 | name: 'max ρ 密度(F^M,beta 幂次)', |
|
763 | 790 | ], |
764 | 791 | }, |
765 | 792 | }, |
| 793 | + // 近似正交概率曲线(右轴):把 |ρ| < t 当作正交;始终双侧口径, |
| 794 | + // 与 UI 单双侧开关无关。数据网格与密度系列一致(负半轴为 0) |
| 795 | + { |
| 796 | + name: 'P(|ρ|≤t) 单对正交概率', |
| 797 | + type: 'line', |
| 798 | + showSymbol: false, |
| 799 | + yAxisIndex: 1, |
| 800 | + color: '#dc2626', |
| 801 | + lineStyle: { width: 2 }, |
| 802 | + data: td.probPair, |
| 803 | + }, |
| 804 | + { |
| 805 | + name: 'P(max|ρ|≤t) 全部正交概率', |
| 806 | + type: 'line', |
| 807 | + showSymbol: false, |
| 808 | + yAxisIndex: 1, |
| 809 | + color: '#0d9488', |
| 810 | + lineStyle: { width: 2 }, |
| 811 | + data: td.probMax, |
| 812 | + }, |
766 | 813 | ].concat(mcOv.series), |
767 | 814 | }, |
768 | 815 | { notMerge: true } |
|
0 commit comments