feat: 添加 Props 类型

This commit is contained in:
zdl
2025-11-25 15:46:33 +08:00
parent 2037e65ee4
commit 11821d8256
3 changed files with 13 additions and 11 deletions

View File

@@ -150,10 +150,10 @@ export const useEventMarker = (
try {
if (markerId) {
chart.removeOverlay(markerId);
chart.removeOverlay({ id: markerId } as any);
}
if (highlightId) {
chart.removeOverlay(highlightId);
chart.removeOverlay({ id: highlightId } as any);
}
setMarker(null);
@@ -216,10 +216,10 @@ export const useEventMarker = (
if (chart) {
try {
if (markerId) {
chart.removeOverlay(markerId);
chart.removeOverlay({ id: markerId } as any);
}
if (highlightId) {
chart.removeOverlay(highlightId);
chart.removeOverlay({ id: highlightId } as any);
}
} catch (err) {
// 忽略清理时的错误

View File

@@ -69,7 +69,7 @@ export const createIndicator = (
*/
export const removeIndicator = (chart: Chart, indicatorId?: string): void => {
safeChartOperation('removeIndicator', () => {
chart.removeIndicator(indicatorId);
chart.removeIndicator(indicatorId ? { id: indicatorId } as any : undefined);
logger.debug('chartUtils', '移除技术指标 (removeIndicator)', { indicatorId });
});
};
@@ -271,7 +271,7 @@ export const subscribeChartEvent = (
handler: (...args: any[]) => void
): void => {
safeChartOperation(`subscribeChartEvent:${eventName}`, () => {
chart.subscribeAction(eventName, handler);
chart.subscribeAction(eventName as any, handler);
logger.debug('chartUtils', '订阅图表事件 (subscribeChartEvent)', { eventName });
});
};
@@ -289,7 +289,7 @@ export const unsubscribeChartEvent = (
handler: (...args: any[]) => void
): void => {
safeChartOperation(`unsubscribeChartEvent:${eventName}`, () => {
chart.unsubscribeAction(eventName, handler);
chart.unsubscribeAction(eventName as any, handler);
logger.debug('chartUtils', '取消订阅图表事件 (unsubscribeChartEvent)', { eventName });
});
};

View File

@@ -64,10 +64,12 @@ export const createEventMarkerOverlay = (
style: 'fill',
color: marker.color,
borderRadius: EVENT_MARKER_CONFIG.text.borderRadius,
paddingLeft: EVENT_MARKER_CONFIG.text.padding,
paddingRight: EVENT_MARKER_CONFIG.text.padding,
paddingTop: EVENT_MARKER_CONFIG.text.padding,
paddingBottom: EVENT_MARKER_CONFIG.text.padding,
padding: [
EVENT_MARKER_CONFIG.text.padding,
EVENT_MARKER_CONFIG.text.padding,
EVENT_MARKER_CONFIG.text.padding,
EVENT_MARKER_CONFIG.text.padding,
] as any,
},
},
// 标记文本内容