Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

4.0 的 guide 在解析 'min', 'max' 时存在问题 #1354

Closed
1 task done
El-Chiang opened this issue Jan 27, 2022 · 1 comment
Closed
1 task done

4.0 的 guide 在解析 'min', 'max' 时存在问题 #1354

El-Chiang opened this issue Jan 27, 2022 · 1 comment
Assignees
Labels

Comments

@El-Chiang
Copy link
Contributor

El-Chiang commented Jan 27, 2022

  • I have searched the issues of this repository and believe that this is not a duplicate.

Reproduction link

// 解析record里的模板字符串,如min、max、50%...
parseReplaceStr(value, scale) {
const replaceMap = { min: 0, max: 1, median: 0.5 };
// 传入的是 min、max、median 的
if (!isNil(replaceMap[value])) {
return scale.invert(replaceMap[value]);
}
// 传入的是 xx%
if (isString(value) && value.indexOf('%') != -1 && !isNaN(Number(value.slice(0, -1)))) {
const rateValue = Number(value.slice(0, -1));
const percent = rateValue / 100;
return scale.invert(percent);
}
return value;
}

Steps to reproduce

这里 min max medium 写死了 0, 1, 0.5,而没有根据 scale 去取,导致当实际 min max 不为 0 1 时,这里计算点的坐标时会出现 NaN

Environment Info
f2 4.0.0-alpha.9
System -
Browser -
@El-Chiang El-Chiang self-assigned this Jan 27, 2022
@El-Chiang El-Chiang added the bug label Feb 16, 2022
@El-Chiang
Copy link
Contributor Author

#1381 fixed

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
Projects
None yet
Development

No branches or pull requests

1 participant