update pay function
This commit is contained in:
@@ -11,7 +11,7 @@ import {
|
||||
useColorMode,
|
||||
Tooltip,
|
||||
} from '@chakra-ui/react';
|
||||
import * as LightweightCharts from 'lightweight-charts';
|
||||
import { createChart, LineSeries } from 'lightweight-charts';
|
||||
import type { IChartApi, ISeriesApi, LineData, Time } from 'lightweight-charts';
|
||||
import {
|
||||
FaExpand,
|
||||
@@ -74,11 +74,11 @@ const TradingViewChart: React.FC<TradingViewChartProps> = ({
|
||||
try {
|
||||
// 调试信息
|
||||
console.log('🔍 TradingView Chart - 开始初始化');
|
||||
console.log('📦 LightweightCharts 模块:', LightweightCharts);
|
||||
console.log('📊 createChart 函数类型:', typeof LightweightCharts.createChart);
|
||||
console.log('📊 createChart 函数类型:', typeof createChart);
|
||||
console.log('📊 LineSeries 类型:', LineSeries);
|
||||
|
||||
// 创建图表 (lightweight-charts 5.0 标准 API)
|
||||
const chart = LightweightCharts.createChart(chartContainerRef.current, {
|
||||
const chart = createChart(chartContainerRef.current, {
|
||||
width: chartContainerRef.current.clientWidth,
|
||||
height: 500,
|
||||
layout: {
|
||||
@@ -149,7 +149,8 @@ const TradingViewChart: React.FC<TradingViewChartProps> = ({
|
||||
}
|
||||
|
||||
// 创建折线系列 (lightweight-charts 5.0 使用 addSeries 方法)
|
||||
const lineSeries = chart.addSeries('Line', {
|
||||
// 第一个参数是 series 类本身(不是实例)
|
||||
const lineSeries = chart.addSeries(LineSeries, {
|
||||
color: themeColors.primary.gold,
|
||||
lineWidth: 2,
|
||||
crosshairMarkerVisible: true,
|
||||
@@ -209,8 +210,8 @@ const TradingViewChart: React.FC<TradingViewChartProps> = ({
|
||||
console.error('Error details:', {
|
||||
message: error.message,
|
||||
stack: error.stack,
|
||||
LightweightChartsModule: LightweightCharts,
|
||||
createChartType: typeof LightweightCharts.createChart,
|
||||
createChartType: typeof createChart,
|
||||
LineSeriesType: typeof LineSeries,
|
||||
});
|
||||
// 重新抛出错误让 ErrorBoundary 捕获
|
||||
throw error;
|
||||
|
||||
Reference in New Issue
Block a user