modify bar chart style

This commit is contained in:
MaysWind
2021-01-28 00:34:37 +08:00
parent 1f6fae471c
commit 217c15a746
3 changed files with 163 additions and 4 deletions
+11
View File
@@ -0,0 +1,11 @@
export default function (value, precision, lowPrecisionValue) {
const ratio = Math.pow(10, precision);
const normalizedValue = Math.floor(value * ratio);
if (value > 0 && normalizedValue < 1 && lowPrecisionValue) {
return lowPrecisionValue + '%';
}
const result = normalizedValue / ratio;
return result + '%';
}