using System;
using System.Collections.Generic;
namespace HDL_ON.UI
{
///
/// 饼图
///
public class EchartsOption_Pie
{
public string InitDateJson(Dictionary 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;
}
///
/// 获取曲线控件共通Option
///
///
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
}
///
/// 颜色列表
///
///
public List ColorList ()
{
var list = new List();
return list;
}
}
}