xm
2021-12-01 6d73bf6e816570291865674bef8bce8972e4de3f
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
using System;
using System.Collections.Generic;
 
namespace HDL_ON.UI
{
    /// <summary>
    /// 饼图
    /// </summary>
    public class 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";
            }
            //获取曲线控件共通Option
            //{0}:光标移动时,那条竖线的颜色
            //{1}:X轴的组员项
            //{2}:Y轴的单位格式
            //{3}:X轴组员对应的值
            //{4}:曲线的颜色
            string commonJson = this.GetChartControlCommonOption();
            commonJson = commonJson.Replace("{0}", valueText);
            return commonJson;
        }
 
 
        /// <summary>
        /// 获取曲线控件共通Option
        /// </summary>
        /// <returns></returns>
        private string GetChartControlCommonOption()
        {
        //{0}:数据
 
        //tooltip:
        //    {
        //    trigger: 'item',
        //            padding: 40,
        //            textStyle:
        //        {
        //        fontSize: 38,
        //            },
        //            show: true,
        //            trigger: 'item',
        //            position:['1%', '1%']
        //        },
#if __IOS__
            return @"{
                series : [
                 {
                    right: '54%',
                    bottom:'54%',
                    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 @"{
                series : [
                 {
                    //right: '54%',
                    //bottom:'54%',
                    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]
                                  }
                             },
                       }
                   }
                   ]
            }";
#endif
        }
 
        /// <summary>
        /// 颜色列表
        /// </summary>
        /// <returns></returns>
        public List<string> ColorList ()
        {
            var list = new List<string>();
            return list;
        }
    }
}