From 769725931ef28d1a86b0fdd89cf5a44faf7bec27 Mon Sep 17 00:00:00 2001
From: king <18310653075@163.com>
Date: 星期一, 03 八月 2020 12:07:57 +0800
Subject: [PATCH] 2020-08-03

---
 src/tabviews/zshare/chartcomponent/index.jsx |   22 +++++++++++++++++-----
 1 files changed, 17 insertions(+), 5 deletions(-)

diff --git a/src/tabviews/zshare/chartcomponent/index.jsx b/src/tabviews/zshare/chartcomponent/index.jsx
index 80e3629..f791085 100644
--- a/src/tabviews/zshare/chartcomponent/index.jsx
+++ b/src/tabviews/zshare/chartcomponent/index.jsx
@@ -431,10 +431,15 @@
     let _data = []
     let _valfield = 'value'
     let _typefield = 'key'
+    let ispercent = false
 
     if (plot.datatype === 'statistics') {
       _valfield = plot.InfoValue
       _typefield = plot.InfoType
+
+      if (percentFields.length > 0) {
+        ispercent = true
+      }
 
       _data = this.getStaticData()
     } else {
@@ -490,7 +495,8 @@
       })
     }
     chart.scale(_valfield, {
-      nice: true
+      nice: true,
+      range: [0, 0.93]
     })
 
     // 鍧愭爣杞存牸寮忓寲
@@ -540,7 +546,7 @@
       .tooltip(`${plot.Xaxis}*${_valfield}*${_typefield}`, (name, value, type) => {
         return {
           name: type,
-          value: percentFields.includes(type) ? value + '%' : value
+          value: percentFields.includes(type) || ispercent ? value + '%' : value
         }
       })
 
@@ -746,10 +752,15 @@
     let _data = []
     let _valfield = 'value'
     let _typefield = 'key'
+    let ispercent = false
 
     if (plot.datatype === 'statistics') {
       _valfield = plot.InfoValue
       _typefield = plot.InfoType
+
+      if (percentFields.length > 0) {
+        ispercent = true
+      }
 
       _data = this.getStaticData()
     } else {
@@ -804,7 +815,8 @@
     chart.data(_data)
 
     chart.scale(_valfield, {
-      nice: true
+      nice: true,
+      range: [0, 0.93]
     })
 
     // 鍧愭爣杞存牸寮忓寲
@@ -862,7 +874,7 @@
         .tooltip(`${plot.Xaxis}*${_valfield}*${_typefield}`, (name, value, type) => {
           return {
             name: type,
-            value: percentFields.includes(type) ? value + '%' : value
+            value: percentFields.includes(type) || ispercent ? value + '%' : value
           }
         })
 
@@ -879,7 +891,7 @@
         .tooltip(`${plot.Xaxis}*${_valfield}*${_typefield}`, (name, value, type) => {
           return {
             name: type,
-            value: percentFields.includes(type) ? value + '%' : value
+            value: percentFields.includes(type) || ispercent ? value + '%' : value
           }
         })
 

--
Gitblit v1.8.0