forked from github/dataease
Merge pull request #11926 from dataease/pr@dev-v2@chart-world-cloud-style
style(图表-词云图): 优化大小配置中的最大最小值,当清空输入框时,补全默认的最大最小值
This commit is contained in:
commit
f2cd14b1db
@ -630,13 +630,19 @@ export const getMaxAndMinValueByData = (
|
||||
minValue: number,
|
||||
callback: (max: number, min: number) => void
|
||||
) => {
|
||||
if (minValue === 0 && maxValue === 0) {
|
||||
const maxResult = data.reduce((max, current) => {
|
||||
return current[field] > max ? current[field] : max
|
||||
}, Number.MIN_SAFE_INTEGER)
|
||||
const minResult = data.reduce((min, current) => {
|
||||
return current[field] < min ? current[field] : min
|
||||
}, Number.MAX_SAFE_INTEGER)
|
||||
if ((minValue === 0 && maxValue === 0) || minValue === null || maxValue === null) {
|
||||
let maxResult = maxValue
|
||||
let minResult = minValue
|
||||
if (maxResult === null) {
|
||||
maxResult = data.reduce((max, current) => {
|
||||
return current[field] > max ? current[field] : max
|
||||
}, Number.MIN_SAFE_INTEGER)
|
||||
}
|
||||
if (minResult === null) {
|
||||
minResult = data.reduce((min, current) => {
|
||||
return current[field] < min ? current[field] : min
|
||||
}, Number.MAX_SAFE_INTEGER)
|
||||
}
|
||||
callback(maxResult, minResult)
|
||||
}
|
||||
}
|
||||
|
Loading…
Reference in New Issue
Block a user