diff --git a/frontend/app/page.tsx b/frontend/app/page.tsx index c7e77bd0..d60ee28e 100644 --- a/frontend/app/page.tsx +++ b/frontend/app/page.tsx @@ -248,7 +248,7 @@ export default function HomePage() {

TradingAgentsX 模擬真實交易公司,配備專業化的 LLM 代理

- +
0; return ( - + diff --git a/frontend/components/analysis/PriceChart.tsx b/frontend/components/analysis/PriceChart.tsx index 37481874..3930942e 100644 --- a/frontend/components/analysis/PriceChart.tsx +++ b/frontend/components/analysis/PriceChart.tsx @@ -6,6 +6,7 @@ import { Line, BarChart, Bar, + Cell, XAxis, YAxis, CartesianGrid, @@ -44,7 +45,7 @@ export function PriceChart({ priceData, priceStats, ticker }: PriceChartProps) {
{ticker} 價格走勢 - setChartType(v as "line" | "candlestick")}> + setChartType(v as "line" | "candlestick")}> 折線圖 K線圖 @@ -109,8 +110,8 @@ export function PriceChart({ priceData, priceStats, ticker }: PriceChartProps) { /> ) : ( - // 真正的K線圖(蠟燭圖) - + // K線圖:簡化版實現 + { if (active && payload && payload.length) { const data = payload[0].payload; + const isUp = data.Close >= data.Open; return (

日期: {data.Date}

-

開: ${formatNumber(data.Open)}

-

收: ${formatNumber(data.Close)}

+

+ 開: ${formatNumber(data.Open)} +

+

+ 收: ${formatNumber(data.Close)} +

高: ${formatNumber(data.High)}

低: ${formatNumber(data.Low)}

+

+ {isUp ? '↑ 上漲' : '↓ 下跌'} ${formatNumber(Math.abs(data.Close - data.Open))} +

); @@ -140,73 +149,19 @@ export function PriceChart({ priceData, priceStats, ticker }: PriceChartProps) { return null; }} /> - { - const { x, y, width, payload } = props; - const { Open, Close, High, Low } = payload; - - // 計算Y軸的比例尺 - const yAxis = props.yAxis; - const yScale = (value: number) => { - const { domain, height } = yAxis; - const [min, max] = domain; - return height - ((value - min) / (max - min)) * height; - }; - - const openY = yScale(Open); - const closeY = yScale(Close); - const highY = yScale(High); - const lowY = yScale(Low); - - // 判斷漲跌 - const isUp = Close >= Open; - const color = isUp ? '#22c55e' : '#ef4444'; // 綠色上漲,紅色下跌 - const fillColor = isUp ? '#22c55e' : '#ef4444'; - - // K線寬度 - const candleWidth = Math.min(width * 0.6, 8); - const centerX = x + width / 2; - - // 實體高度 - const bodyHeight = Math.abs(closeY - openY); - const bodyY = Math.min(openY, closeY); - - return ( - - {/* 上影線 */} - - {/* 下影線 */} - - {/* K線實體 */} - - - ); - }} - /> -
+ {/* 使用 Bar 顯示收盤價,顏色根據漲跌決定 */} + + {priceData.map((entry: any, index: number) => ( + = entry.Open ? '#22c55e' : '#ef4444'} + /> + ))} + + )}
diff --git a/frontend/components/layout/Footer.tsx b/frontend/components/layout/Footer.tsx index 400ba4ff..077baa27 100644 --- a/frontend/components/layout/Footer.tsx +++ b/frontend/components/layout/Footer.tsx @@ -3,7 +3,7 @@ */ export function Footer() { return ( -