diff --git a/client/src/pages/BossPage.tsx b/client/src/pages/BossPage.tsx index 7249283..d72f09f 100644 --- a/client/src/pages/BossPage.tsx +++ b/client/src/pages/BossPage.tsx @@ -102,12 +102,15 @@ export function BossPage() { // 瀑布图累计计算 let cumulative = 0 const waterfallChart = waterfallSteps.map((step) => { - if (step.type === 'total' || step.type === 'profit') { + if (step.type === 'total') { cumulative = step.value - return { name: step.name, base: 0, value: step.value, fill: step.type === 'profit' ? '#22c55e' : '#3b82f6' } + return { name: step.name, base: 0, value: step.value, fill: '#3b82f6' } + } else if (step.type === 'profit') { + return { name: step.name, base: 0, value: step.value, fill: '#22c55e' } } else { - const base = cumulative + step.value - const result = { name: step.name, base, value: -step.value, fill: '#ef4444' } + const decrease = Math.abs(step.value) + const base = cumulative - decrease + const result = { name: step.name, base, value: decrease, fill: '#ef4444' } cumulative = base return result }