diff --git a/src/components/charts/InvestCandleChart.tsx b/src/components/charts/InvestCandleChart.tsx
index ae49855..7daac28 100644
--- a/src/components/charts/InvestCandleChart.tsx
+++ b/src/components/charts/InvestCandleChart.tsx
@@ -1067,15 +1067,13 @@ export default function InvestCandleChart({
{/* 일반 candle 값 or dot 전용 candle 값 구분 */}
{(() => {
- // dotData도 있는 날짜면
const dot = dotData?.find((d) =>
dayjs(d.date).isSame(tooltip.data!.date, "day")
);
- // "오늘" 날짜인지 확인
const isToday = dayjs(tooltip.data!.date).isSame(dayjs(), "day");
- // 오늘이고 todayPrice가 있을 때 (실시간)
- if (isToday && todayPrice && dot && dot.close) {
+ // 실시간 시세 + 예측값만 있는 경우 (오늘)
+ if (isToday && todayPrice && dot?.close) {
return (
<>
@@ -1086,7 +1084,6 @@ export default function InvestCandleChart({
-
예측값
: {dot.close.toLocaleString()}
@@ -1095,47 +1092,55 @@ export default function InvestCandleChart({
);
}
- // dotData(예측값)가 있는 경우
- if (dot) {
+ // 예측값만 있는 경우
+ if (
+ dot?.close &&
+ (!tooltip.data?.open || tooltip.data.volume === 0)
+ ) {
return (
예측값
- {" "}
+
: {dot.close.toLocaleString()}
);
}
- // 일반 candle 값 표기
- return (
- <>
-
시: {tooltip.data.open.toLocaleString()}
-
고: {tooltip.data.high.toLocaleString()}
-
저: {tooltip.data.low.toLocaleString()}
-
종: {tooltip.data.close.toLocaleString()}
-
거래량: {tooltip.data.volume.toLocaleString()}
-
- {/* RSI:{" "}
- {typeof rsi_visible[tooltip.idx] === "number"
- ? rsi_visible[tooltip.idx].toFixed(2)
- : "-"} */}
- RSI: {rsi}
-
- {/* dot값이 겹치는 경우 오차 등도 표시 */}
- {dot && (dot as any).close !== undefined && (
-
- 오차: {((dot as any).close - tooltip.data.close).toFixed(2)}{" "}
- (
- {(
- (((dot as any).close - tooltip.data.close) /
- tooltip.data.close) *
- 100
- ).toFixed(2)}
- %)
-
- )}
- >
+
+ // 일반 캔들값 (or 예측값도 있는 경우 같이 표시)
+ const rows = [];
+
+ rows.push(
+
시: {tooltip.data.open.toLocaleString()}
,
+
고: {tooltip.data.high.toLocaleString()}
,
+
저: {tooltip.data.low.toLocaleString()}
,
+
종: {tooltip.data.close.toLocaleString()}
,
+
+ 거래량: {tooltip.data.volume.toLocaleString()}
+
,
+
RSI: {rsi}
);
+
+ if (dot?.close) {
+ rows.push(
+
+
+ 예측값
+
+ : {dot.close.toLocaleString()}
+
,
+
+ 오차: {(dot.close - tooltip.data.close).toFixed(2)} (
+ {(
+ ((dot.close - tooltip.data.close) / tooltip.data.close) *
+ 100
+ ).toFixed(2)}
+ %)
+
+ );
+ }
+
+ return rows;
})()}
{/* 뉴스 영역 그대로 */}
{tooltipNews.length > 0 && (