using System; using System.Text; using CB.Entity; using CB.Interface; namespace CB.TrendChart { /// /// 单值项(单值多列项) /// /// public class SingleValueItem : ChartItemRepository, IChartItem where TEntity : LotteryOpenCode { public override void Init(ChartCssConfigInfo cssConfig, TrendChartItemInfo itemConfig) { DefaultInit(cssConfig, itemConfig); } public override void MissDataInit(TrendChartData TrendChartCofig, int i) { DefaultMissDataInit(TrendChartCofig, i); } public override string GetMissData(MissDataType missDataType) { return GetDefaultMissData(missDataType); } public override bool SetItemValue(TEntity entity,TEntity nextentity) { return SetSingleValueAndMiss(entity, nextentity); } public override bool SetItemValue(TEntity entity) { return SetSingleValueAndMiss(entity,null); } public override string GetFomartString(string fomart, ChartCssConfigInfo cssConfig = null) { var html = GetFomartHTML(fomart, cssConfig); //var attr = ""; //if (this._itemConfig.DrawLine) //{ // attr = " lgroup=\"" + this._itemConfig.Id + "\" lcolor=\"" + html.Item4 + "\""; //} var sp = new StringBuilder((html.Item1.Length + 40) * this._itemConfig.ItemCount); for (int i = 0; i < this._itemConfig.ItemCount; i++) { if (_itemValue == "") { sp.Append(GetHtml(false, html.Item1, GetlgroupAndColor(false, html.Item4), _localMiss[i].ToString(), i)); } else { sp.Append(this._itemIndex == i ? GetHtml(true, html.Item1, GetlgroupAndColor(true, html.Item4), _itemValue, i) : GetHtml(false, html.Item1, GetlgroupAndColor(false, html.Item4), _localMiss[i].ToString(), i)); } } return sp.ToString(); } } }