From ebf88d2b130ecda04144c5dd2de6211a4e2eeddb Mon Sep 17 00:00:00 2001 From: Jin-Hee Park <53548023+jhee564@users.noreply.github.com> Date: Wed, 18 May 2022 17:10:15 +0900 Subject: [PATCH] =?UTF-8?q?[#1170]=20line=20Chart=20>=20select=20Series=20?= =?UTF-8?q?=EA=B4=80=EB=A0=A8=ED=95=98=EC=97=AC=20=EA=B0=84=ED=98=88?= =?UTF-8?q?=EC=A0=81=EC=9C=BC=EB=A1=9C=20=EC=97=90=EB=9F=AC=EB=A1=9C?= =?UTF-8?q?=EA=B7=B8=20=EB=B0=9C=EC=83=9D=20(#1171)?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit * [#1170] line Chart > select Series 관련하여 간혈적으로 에러로그 발생 - 배열 구조분해할당 전 배열이 맞는지 확인하는 로직 추가 * Update minor version (3.3.21 -> 3.3.22) Co-authored-by: jinhee park --- package.json | 2 +- src/components/chart/model/model.store.js | 10 ++++++++++ 2 files changed, 11 insertions(+), 1 deletion(-) diff --git a/package.json b/package.json index 06d968133..c15e4d44b 100644 --- a/package.json +++ b/package.json @@ -1,6 +1,6 @@ { "name": "evui", - "version": "3.3.21", + "version": "3.3.22", "description": "A EXEM Library project", "author": "exem ", "license": "MIT", diff --git a/src/components/chart/model/model.store.js b/src/components/chart/model/model.store.js index 3b17051ed..5587b2a6d 100644 --- a/src/components/chart/model/model.store.js +++ b/src/components/chart/model/model.store.js @@ -698,9 +698,15 @@ const modules = { vector: { start: position[dataIndex - 1], end: position[dataIndex] }, })); + const isEmptyVector = (arr => !arr || !Array.isArray(arr) || arr?.length !== 2); + // canvas 의 클릭 위치값은 제 4 사분면의 위치이므로 clickedY, y1, y2 의 값은 음수를 취한다. if (isStackChart) { hitSeries = vectorList.find(({ vector }) => { + if (isEmptyVector(vector?.start) && isEmptyVector(vector?.end)) { + return false; + } + const [x1, y1] = vector.start; const [x2, y2] = vector.end; const v1 = [x2 - x1, y1 - y2]; @@ -713,6 +719,10 @@ const modules = { })?.sId; } else { hitSeries = vectorList.find(({ vector }) => { + if (isEmptyVector(vector?.start) && isEmptyVector(vector?.end)) { + return false; + } + const [x1, y1] = vector.start; const [x2, y2] = vector.end; const a = (y1 - y2) / (x2 - x1);