Refine pricing display and Gaussian context

This commit is contained in:
2569718930@qq.com
2026-06-07 01:08:13 +08:00
parent fb4a144fcf
commit f66127da44
10 changed files with 128 additions and 60 deletions
@@ -1660,7 +1660,7 @@ export function runTests() {
const firstBand = bandPoints[0].runway_band;
assert(Array.isArray(firstBand) && firstBand[0] === 24.0 && firstBand[1] === 26.0, "runway_band tuple values should match input limits");
// ── Legacy Gaussian probability data should not render as a visible chart overlay ──
// ── Legacy Gaussian probability data should be available as compact tooltip context only ──
const gaussianOverlayChart = __buildTemperatureChartDataForTest(
{
city: "toronto",
@@ -1688,9 +1688,13 @@ export function runTests() {
) as any;
const gaussianOverlay = gaussianOverlayChart.probabilityOverlay;
assert(gaussianOverlay === null, "legacy Gaussian probabilities should not create visible chart overlays");
assert(
gaussianOverlay?.muLine?.label === "Gaussian μ 27.4°C" &&
gaussianOverlay.bands.length === 3,
"legacy Gaussian probabilities should remain available for compact tooltip context",
);
assert(
!gaussianOverlayChart.series.some((series: any) => String(series.key || "").includes("probability")),
"legacy Gaussian probability distribution should not be rendered as a time-series line",
"legacy Gaussian probability distribution should not be rendered as a time-series line on the main chart",
);
}
@@ -1,3 +1,7 @@
import {
readFileSync,
} from "node:fs";
import path from "node:path";
import {
__buildTemperatureTooltipProbabilityRowsForTest,
__buildTemperatureTooltipRowsForTest,
@@ -73,7 +77,23 @@ export function runTests() {
);
assert(
probabilityRows.length === 0,
"temperature tooltip should not show Gaussian μ or probability-band rows",
probabilityRows.length === 2,
"temperature tooltip should show Gaussian μ and the leading probability bucket as compact context",
);
assert(
probabilityRows.some((row) => row.key === "legacy_probability_mu" && row.value === "27.4°C") &&
probabilityRows.some((row) => row.key === "legacy_probability_27_0" && row.value === "42%"),
"temperature tooltip should format Gaussian μ and probability values without drawing a full probability band on the main chart",
);
const projectRoot = process.cwd();
const chartCanvasSource = readFileSync(
path.join(projectRoot, "components", "dashboard", "scan-terminal", "TemperatureChartCanvas.tsx"),
"utf8",
);
assert(
chartCanvasSource.includes("probabilityOverlay={probabilityOverlay}") &&
!chartCanvasSource.includes("probabilityOverlay={null}"),
"temperature chart canvas must pass probability overlay data into the tooltip instead of hiding Gaussian μ",
);
}