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

@ -153,9 +153,20 @@ 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

@ -153,9 +153,20 @@ 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