| | |
| | | /// </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"; |
| | | } |
| | | //获取曲线控件共通Option |
| | | //{0}:光标移动时,那条竖线的颜色 |
| | | //{1}:X轴的组员项 |
| | | //{2}:Y轴的单位格式 |
| | | //{3}:X轴组员对应的值 |
| | | //{4}:曲线的颜色 |
| | | string commonJson = this.GetChartControlCommonOption(); |
| | | commonJson = commonJson.Replace("{0}", valueText); |
| | | return commonJson; |
| | | } |
| | | |
| | | public class OpthionData |
| | | |
| | | /// <summary> |
| | | /// 获取曲线控件共通Option |
| | | /// </summary> |
| | | /// <returns></returns> |
| | | private string GetChartControlCommonOption() |
| | | { |
| | | public int value = 0; |
| | | public string name = ""; |
| | | //{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 |
| | | } |
| | | |
| | | public class ItemStyle |
| | | /// <summary> |
| | | /// 颜色列表 |
| | | /// </summary> |
| | | /// <returns></returns> |
| | | public List<string> ColorList () |
| | | { |
| | | |
| | | var list = new List<string>(); |
| | | return list; |
| | | } |
| | | } |
| | | } |