feat: StockChartModal.tsx 替换 KLine 实现
This commit is contained in:
@@ -78,10 +78,16 @@ function generateTimeRange(data, startTime, endTime, basePrice, session) {
|
||||
|
||||
const volume = Math.floor(Math.random() * 500000000 + 100000000);
|
||||
|
||||
// ✅ 修复:为分时图添加完整的 OHLC 字段
|
||||
const closePrice = parseFloat(price.toFixed(2));
|
||||
data.push({
|
||||
time: formatTime(current),
|
||||
price: parseFloat(price.toFixed(2)),
|
||||
close: parseFloat(price.toFixed(2)),
|
||||
timestamp: current.getTime(), // ✅ 新增:毫秒时间戳
|
||||
open: parseFloat((price * 0.9999).toFixed(2)), // ✅ 新增:开盘价(略低于收盘)
|
||||
high: parseFloat((price * 1.0002).toFixed(2)), // ✅ 新增:最高价(略高于收盘)
|
||||
low: parseFloat((price * 0.9997).toFixed(2)), // ✅ 新增:最低价(略低于收盘)
|
||||
close: closePrice, // ✅ 保留:收盘价
|
||||
price: closePrice, // ✅ 保留:兼容字段(供 MiniTimelineChart 使用)
|
||||
volume: volume,
|
||||
prev_close: basePrice
|
||||
});
|
||||
|
||||
Reference in New Issue
Block a user