optmization

This commit is contained in:
jiaming743 2020-06-16 14:24:02 +08:00
parent b17399416a
commit beaef5c59a
1 changed files with 2 additions and 3 deletions

View File

@ -155,15 +155,14 @@ export default {
const min = Math.min(...value) || 0 const min = Math.min(...value) || 0
// // abs of min
const minAbs = Math.abs(min) const minAbs = Math.abs(min)
const max = Math.max(...value) || 0 const max = Math.max(...value) || 0
// // abs of max
const maxAbs = Math.abs(max) const maxAbs = Math.abs(max)
//
const total = max + minAbs const total = max + minAbs
data = data.map((row, i) => ({ ...row, ranking: i + 1, percent: (row.value + minAbs) / total * 100 })) data = data.map((row, i) => ({ ...row, ranking: i + 1, percent: (row.value + minAbs) / total * 100 }))