fix: debugger的波形显示修复

This commit is contained in:
SikongJueluo 2025-07-21 21:36:18 +08:00
parent 5da9d9f4e2
commit 3535b94123
1 changed files with 5 additions and 8 deletions

View File

@ -180,15 +180,12 @@ const option = computed((): EChartsOption => {
// //
function buildVcdLine(valArr: number[], high: number, low: number) { function buildVcdLine(valArr: number[], high: number, low: number) {
const points: {x: number, y: number}[] = []; const points: {x: number, y: number}[] = [];
for (let i = 0; i < valArr.length; i++) { let lastValue = high;
const v = valArr[i] > 0 ? high : low; points.push({x: xArr[0], y: lastValue});
for (let i = 1; i < valArr.length; i++) {
const v = valArr[i] !== valArr[i-1] ? (lastValue === high ? low : high) : lastValue;
points.push({x: xArr[i], y: v}); points.push({x: xArr[i], y: v});
// lastValue = v;
if (i < valArr.length - 1 && valArr[i] !== valArr[i+1]) {
// x+0.3y
const nextV = valArr[i+1] > 0 ? high : low;
points.push({x: xArr[i]+0.3, y: nextV});
}
} }
// yxcategory // yxcategory
return points.map(p => p.y); return points.map(p => p.y);