Skip to content

Commit

Permalink
[#1630] Chart > label 개수보다 data 개수가 많을 경우 예외 처리 (#1637)
Browse files Browse the repository at this point in the history
##############################################
- line Chart 그릴 때 x값이 undefined면 o(original value)가 null일 때와 동일하게 처리되도록 로직 추가
- 툴팁에 표시할 아이템을 찾는 로직에서 x값이 undefined인 요소는 제외하고 탐색하도록 로직 수정
  • Loading branch information
jhee564 authored Mar 13, 2024
1 parent c44a65a commit 83bca54
Showing 1 changed file with 7 additions and 4 deletions.
11 changes: 7 additions & 4 deletions src/components/chart/element/element.line.js
Original file line number Diff line number Diff line change
Expand Up @@ -140,7 +140,10 @@ class Line {
}
}

const isNullValue = Util.isNullOrUndefined(prev.o) || Util.isNullOrUndefined(curr.o);
const isNullValue = Util.isNullOrUndefined(prev.o)
|| Util.isNullOrUndefined(curr.o)
|| Util.isNullOrUndefined(curr.x)
|| Util.isNullOrUndefined(curr.y);
if (isNullValue || needCutoff) {
ctx.moveTo(x, y);
needCutoff = false;
Expand Down Expand Up @@ -308,7 +311,7 @@ class Line {
const xp = offset[0];
const yp = offset[1];
const item = { data: null, hit: false, color: this.color };
const gdata = this.data;
const gdata = this.data.filter(data => !Util.isNullOrUndefined(data.x));
const SPARE_XP = 0.5;

if (gdata?.length) {
Expand Down Expand Up @@ -392,7 +395,7 @@ class Line {
}
}

if (item?.data?.o === this.passingValue) {
if (this.usePassingValue && item?.data?.o === this.passingValue) {
item.data = null;
}

Expand All @@ -409,7 +412,7 @@ class Line {
const xp = offset[0];
const yp = offset[1];
const item = { data: null, hit: false, color: this.color };
const gdata = this.data;
const gdata = this.data.filter(data => !Util.isNullOrUndefined(data.x));

let s = 0;
let e = gdata.length - 1;
Expand Down

0 comments on commit 83bca54

Please sign in to comment.