From 52cffc4ab8e9787a6f233295502c7c9788dddae1 Mon Sep 17 00:00:00 2001
From: fxl <473369119@qq.com>
Date: 星期二, 07 三月 2023 10:45:17 +0800
Subject: [PATCH] 3.7

---
 src/main/webapp/hxzk/plugins/apex/custom-apexcharts.js |  198 ++++++++++++++++++++++++++++++++++---------------
 1 files changed, 138 insertions(+), 60 deletions(-)

diff --git a/src/main/webapp/hxzk/plugins/apex/custom-apexcharts.js b/src/main/webapp/hxzk/plugins/apex/custom-apexcharts.js
index 88fd2de..97135d1 100644
--- a/src/main/webapp/hxzk/plugins/apex/custom-apexcharts.js
+++ b/src/main/webapp/hxzk/plugins/apex/custom-apexcharts.js
@@ -6,7 +6,7 @@
         type: "POST",
         url: "/hxzkoa/setweizhi.do",
         dataType: 'json',
-        success (data) {
+        success(data) {
             weizhi = data
         }
     });
@@ -241,7 +241,7 @@
         },
     },
     dataLabels: {
-        enabled: false,
+        enabled: true,
     },
     stroke: {
         show: true,
@@ -279,17 +279,22 @@
 );
 chartdd.render();
 
-var timessss = setInterval(tiao,10000);
+var timessss = setInterval(tiao, 10000);
 function tiao() {
     $.ajax({
         url: "/hxzkoa/setgaojingnum.do",
         type: "POST",
         dataType: "JSON",
-        success(data3){
+        success(data) {
             chartdd.updateSeries([{
                 name: '鍛婅',
-                data: data3
+                data: data.value
             }])
+            chartdd.updateOptions({
+                xaxis: {
+                    categories: data.key
+                }
+            })
         }
     });
     // chartdd.render();
@@ -442,51 +447,124 @@
 
 // Donut Chart
 
+//鐜板満宸ョ
+// var donutChart = {
+//     chart: {
+//         height: 250,
+//         type: 'donut',
+//         toolbar: {
+//             show: false,
+//         }
+//     },
+//     stroke: {
+//         colors: '#0e1726'
+//     },
+//     series: reA_v,
+//     labels: reA_k,
+//     responsive: [{
+//         breakpoint: 480,
+//         options: {
+//             chart: {
+//                 width: 200
+//             },
+//             legend: {
+//                 position: 'bottom'
+//             }
+//         }
+//     }]
+// }
 
-var donutChart = {
-    chart: {
-        height: 250,
-        type: 'donut',
-        toolbar: {
-            show: false,
-        }
-    },
-    stroke: {
-        colors: '#0e1726'
-    },
-    series: reA_v,
-    labels: reA_k,
-    responsive: [{
-        breakpoint: 480,
-        options: {
-            chart: {
-                width: 200
-            },
-            legend: {
-                position: 'bottom'
-            }
-        }
-    }]
+// var donut = new ApexCharts(
+//     document.querySelector("#donut-chart"),
+//     donutChart
+// );
+
+// donut.render();
+// var timesss = setInterval(quan,10000);
+// function quan() {
+//     $.ajax({
+//         url: "/hxzkoa/setgongzhongnum.do",
+//         type: "POST",
+//         dataType: "JSON",
+//         success(data2){
+//             //donut.updateSeries(data2)
+//             donut.updateOptions({
+//             	series: data2[1],
+//                 labels: data2[0]
+//             })
+//         }
+//     });
+// }
+
+var tubiao22 = document.getElementById("donut-chart");
+var ceshi = echarts.init(tubiao22);
+var shuzu = [];
+for (var i = 0; i < reA_k.length; i++) {
+    shuzu[i] = { value: reA_v[i], name: reA_k[i] }
 }
-
-var donut = new ApexCharts(
-    document.querySelector("#donut-chart"),
-    donutChart
-);
-
-donut.render();
-var timesss = setInterval(quan,10000);
+var option;
+option = {
+    tooltip: {
+        trigger: 'item'
+    },
+    legend: {
+        top: '2%',
+        left: 'center',
+        textStyle: {
+      		color: '#d2d7d7'
+    	}
+    },
+    series: [
+        {
+            name: '宸ョ',
+            type: 'pie',
+            radius: ['40%', '70%'],
+            avoidLabelOverlap: false,
+            //itemStyle: {
+            //    borderRadius: 10,
+            //    borderColor: '#fff',
+            //    borderWidth: 2
+            //},
+            label: {
+                show: false,
+                position: 'center'
+            },
+            emphasis: {
+                label: {
+                    show: false,
+                    fontSize: '40',
+                    fontWeight: 'bold'
+                }
+            },
+            labelLine: {
+                show: false
+            },
+            data: shuzu
+        }
+    ]
+};
+ceshi.setOption(option);
+var timesss = setInterval(quan, 10000);
 function quan() {
     $.ajax({
         url: "/hxzkoa/setgongzhongnum.do",
         type: "POST",
         dataType: "JSON",
-        success(data2){
+        success(data2) {
             //donut.updateSeries(data2)
-            donut.updateOptions({
-            	series: data2[1],
-                labels: data2[0]
-            })
+            // donut.updateOptions({
+            //     series: data2[1],
+            //     labels: data2[0]
+            // })
+            var shuzu2 = [];
+            for (var i = 0; i < data2[1].length; i++) {
+                shuzu2[i] = { value: data2[1][i], name: data2[0][i] }
+            }
+            ceshi.setOption({
+                series: [{
+                    data: shuzu2
+                }]
+            });
         }
     });
 }
@@ -505,10 +583,10 @@
     dataLabels: {
         enabled: true,
         background: {
-          enabled: true,
-          borderRadius:1,
+            enabled: true,
+            borderRadius: 1,
         }
-      },
+    },
     stroke: {
         colors: '#0e1726'
     },
@@ -527,12 +605,12 @@
     }]
 }
 
-var chart = new ApexCharts(
-    document.querySelector("#polarArea-chart"),
-    polarAreaChart
-);
-chart.render();
-var times = setInterval(leida,10000);
+//var chart = new ApexCharts(
+//    document.querySelector("#polarArea-chart"),
+//    polarAreaChart
+//);
+//chart.render();
+//var times = setInterval(leida, 10000);
 function leida() {
     $.ajax({
         url: "/hxzkoa/settongjishuju.do",
@@ -540,7 +618,7 @@
         dataType: "JSON",
         success(data) {
             chart.updateOptions({
-            	series: data[1],
+                series: data[1],
                 labels: data[0]
             })
         }
@@ -607,15 +685,15 @@
         max: 1000
     },
 };
-var wasdChart = new ApexCharts(document.getElementById('wasd'), wasdOptions);
-wasdChart.render();
+//var wasdChart = new ApexCharts(document.getElementById('wasd'), wasdOptions);
+//wasdChart.render();
 
-window.setInterval(function () {
-    wasdData.push(weizhi);
-    wasdChart.updateSeries([{
-        data: wasdData
-    }])
-}, 10000)
+//window.setInterval(function () {
+//    wasdData.push(weizhi);
+//    wasdChart.updateSeries([{
+//        data: wasdData
+//    }])
+//}, 10000)
 
 
 // Radial Chart

--
Gitblit v1.10.0