Browse Source

fix: 图表样式调整

TwoKe945 1 year ago
parent
commit
278d25cbd5

+ 8 - 0
app/src/views/FireCondition/components/KeyIndex/KeyChart.vue

@@ -116,7 +116,15 @@ export default {
     reload() {
       // 重载数据
       if (this.chart) {
+        const max = this.items.map(item => parseInt(item.value || 0))
+        console.log(this.items)
         this.chart.setOption({
+          yAxis: {
+            min: 0,
+            max: function (value) {
+                return max[0] === 0 ? 8 : Math.ceil(value.max) ;
+            }
+          },
           series: [
             {
               data: this.items

+ 1 - 1
app/src/views/FireCondition/components/KeyIndex/index.vue

@@ -429,7 +429,7 @@ export default {
           }),
           keys.map(item => {
             let temp = ret.find(i => i.yf == item)
-            return temp ? { name: `${this.month[item]}月`, value: (item.zzjjss / 10000).toFixed(0) } : { name: `${this.month[item]}月`, value: 0 }
+            return temp ? { name: `${this.month[item]}月`, value: parseInt(temp.zjccss / 10000) } : { name: `${this.month[item]}月`, value: 0 }
           })
         ]
         console.log(this.data)

+ 7 - 0
app/src/views/Home/components/FireIndex/Chart.vue

@@ -129,7 +129,14 @@ export default {
     reload() {
       // 重载数据
       if (this.chart) {
+        const max = this.items.map(item => parseInt(item.value || 0)).sort((a,b) => b - a)
         this.chart.setOption({
+          yAxis: {
+            min: 0,
+            max: function (value) {
+                return max[0] === 0 ? 8 : Math.ceil(value.max) ;
+            }
+          },
           series: [
             {
               data: this.items