From f369d0b710357c933ed96e73fd337d22906bb0c8 Mon Sep 17 00:00:00 2001
From: wei <kaede@kaededeMacBook-Air.local>
Date: 星期五, 26 三月 2021 17:02:46 +0800
Subject: [PATCH] 2.新风bus控制命令转换

---
 HDL_ON/UI/UI2/FuntionControlView/EnvironmentalScience/EchartsOption_Pie.cs |  121 ++++++++++++++++++++++++++++++++-------
 1 files changed, 98 insertions(+), 23 deletions(-)

diff --git a/HDL_ON/UI/UI2/FuntionControlView/EnvironmentalScience/EchartsOption_Pie.cs b/HDL_ON/UI/UI2/FuntionControlView/EnvironmentalScience/EchartsOption_Pie.cs
index 2dea8e2..f7ddbdb 100644
--- a/HDL_ON/UI/UI2/FuntionControlView/EnvironmentalScience/EchartsOption_Pie.cs
+++ b/HDL_ON/UI/UI2/FuntionControlView/EnvironmentalScience/EchartsOption_Pie.cs
@@ -8,29 +8,104 @@
     /// </summary>
     public class EchartsOption_Pie
     {
-        public string name = "";
-
-        public string type = "pie";
-
-        public string radius = "55%";
-
-        public List<OpthionData> data = new List<OpthionData>();
-
-        public string itemStyle = "";
-
-        public EchartsOption_Pie()
+        public string InitDateJson(Dictionary<string, string> list)
         {
+            //缁勮Value
+            string valueText = string.Empty;
+            foreach (var dic in list)
+            {
+                valueText += "{value:" + dic.Value + ",name:'" + dic.Key + "'},\r\n";
+            }
+            //鑾峰彇鏇茬嚎鎺т欢鍏遍�歄ption
+            //{0}:鍏夋爣绉诲姩鏃�,閭f潯绔栫嚎鐨勯鑹�
+            //{1}:X杞寸殑缁勫憳椤�
+            //{2}:Y杞寸殑鍗曚綅鏍煎紡
+            //{3}:X杞寸粍鍛樺搴旂殑鍊�
+            //{4}:鏇茬嚎鐨勯鑹�
+            string commonJson = this.GetChartControlCommonOption();
+            commonJson = commonJson.Replace("{0}", valueText);
+            return commonJson;
+        }
+
+
+        /// <summary>
+        /// 鑾峰彇鏇茬嚎鎺т欢鍏遍�歄ption
+        /// </summary>
+        /// <returns></returns>
+        private string GetChartControlCommonOption()
+        {
+            //{0}:鏁版嵁
+#if __IOS__
+            return @"{
+                tooltip: {
+                    trigger: 'item',
+                    padding:40,
+                    textStyle:{
+                        fontSize :38,
+                    },
+                },
+                series : [
+                 {
+                    right: '55%',
+                    bottom:'55%',
+                    labelLine: false,
+                    type: 'pie',
+                    data:[
+                       {0}
+                     ],
+                     itemStyle: {
+                             normal:{
+                                 color:function(params) {
+                                 var colorList = [           
+                                         '#80AEFF','#FFD154','#FF9D54','#FE6A6A','#B183C3','#ADE764',
+                                         '#D7504B','#C6E579','#F4E001','#F0805A','#26C0C0'
+                                         ];
+                                     return colorList[params.dataIndex]
+                                  }
+                             },
+                       }
+                   }
+                   ]
+            }";
+#else
+return @"{
+                tooltip: {
+                    trigger: 'item',
+                },
+                series : [
+                 {
+                    labelLine: false,
+                    type: 'pie',
+                    radius: '25%',
+                    data:[
+                       {0}
+                     ],
+                     itemStyle: {
+                             normal:{
+                                 color:function(params) {
+                                 var colorList = [           
+                                         '#80AEFF','#FFD154','#FF9D54','#FE6A6A','#B183C3','#ADE764',
+                                         '#D7504B','#C6E579','#F4E001','#F0805A','#26C0C0'
+                                         ];
+                                     return colorList[params.dataIndex]
+                                  }
+                             },
+                       }
+                   }
+                   ]
+            }";
+
+#endif
+        }
+
+        /// <summary>
+        /// 棰滆壊鍒楄〃
+        /// </summary>
+        /// <returns></returns>
+        public List<string> ColorList ()
+        {
+            var list = new List<string>();
+            return list;
         }
     }
-
-    public class OpthionData
-    {
-        public int value = 0;
-        public string name = "";
-    }
-
-    public class ItemStyle
-    {
-
-    }
-}
+}
\ No newline at end of file

--
Gitblit v1.8.0