From 9463fa981945f278a639a1303192272732415f22 Mon Sep 17 00:00:00 2001 From: tzy <hxb@hdlchina.com.cn> Date: 星期一, 29 三月 2021 09:20:38 +0800 Subject: [PATCH] Merge remote-tracking branch 'origin/temp-wxr' into dev-tzy --- HDL_ON/UI/UI2/FuntionControlView/EnvironmentalScience/EchartsOption_Pie.cs | 124 +++++++++++++++++++++++++++++++++------- 1 files changed, 101 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..0a807a7 100644 --- a/HDL_ON/UI/UI2/FuntionControlView/EnvironmentalScience/EchartsOption_Pie.cs +++ b/HDL_ON/UI/UI2/FuntionControlView/EnvironmentalScience/EchartsOption_Pie.cs @@ -8,29 +8,107 @@ /// </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}:鏁版嵁 + + //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; } } - - public class OpthionData - { - public int value = 0; - public string name = ""; - } - - public class ItemStyle - { - - } -} +} \ No newline at end of file -- Gitblit v1.8.0