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