Merge branch 'pr/101'

This commit is contained in:
jiaming743 2020-06-16 14:19:34 +08:00
commit b17399416a
2 changed files with 24 additions and 2 deletions

View File

@ -152,10 +152,21 @@ export default {
})
const value = data.map(({ value }) => value)
const min = Math.min(...value) || 0
//
const minAbs = Math.abs(min)
const max = Math.max(...value) || 0
data = data.map((row, i) => ({ ...row, ranking: i + 1, percent: row.value / max * 100 }))
//
const maxAbs = Math.abs(max)
//
const total = max + minAbs
data = data.map((row, i) => ({ ...row, ranking: i + 1, percent: (row.value + minAbs) / total * 100 }))
const rowLength = data.length

View File

@ -152,10 +152,21 @@ export default {
})
const value = data.map(({ value }) => value)
const min = Math.min(...value) || 0
//
const minAbs = Math.abs(min)
const max = Math.max(...value) || 0
data = data.map((row, i) => ({ ...row, ranking: i + 1, percent: row.value / max * 100 }))
//
const maxAbs = Math.abs(max)
//
const total = max + minAbs
data = data.map((row, i) => ({ ...row, ranking: i + 1, percent: (row.value + minAbs) / total * 100 }))
const rowLength = data.length