e 5 سال پیش
والد
کامیت
9eb9656eb6
1فایلهای تغییر یافته به همراه10 افزوده شده و 1 حذف شده
  1. 10 1
      src/views/dashboard/admin/components/RaddarChart.vue

+ 10 - 1
src/views/dashboard/admin/components/RaddarChart.vue

@@ -85,7 +85,16 @@ export default {
             color: '#545454',
             lineHeight: 22,
             formatter: function(param) {
-              return param.name + '(' + Math.round(param.percent) + '%' + ')' + '\n¥' + param.value + ''
+              let result = (+param.value || 0).toString().replace(/^-?\d+/g, m => m.replace(/(?=(?!\b)(\d{3})+$)/g, ','))
+              const temp = result.split('.')
+              if (temp.length === 1) {
+                result += '.00'
+              } else if (temp.length > 1) {
+                if (temp[1].length < 2) {
+                  result += '0'
+                }
+              }
+              return param.name + '(' + Math.round(param.percent) + '%' + ')' + '\n¥' + result
             }
           },
           labelLine: {