MultiValueItem.cs 1.9 KB

12345678910111213141516171819202122232425262728293031323334353637383940414243444546474849505152535455
  1. using System;
  2. using System.Text;
  3. using CB.Entity;
  4. using CB.Interface;
  5. namespace CB.TrendChart
  6. {
  7. /// <summary>
  8. /// 多值项(多值多列项)
  9. /// </summary>
  10. /// <typeparam name="TEntity"></typeparam>
  11. public class MultiValueItem<TEntity> : ChartItemRepository<TEntity>, IChartItem<TEntity> where TEntity : LotteryOpenCode
  12. {
  13. public new int[] _itemIndex;
  14. public override void Init(ChartCssConfigInfo cssConfig, TrendChartItemInfo itemConfig)
  15. {
  16. DefaultInit(cssConfig, itemConfig);
  17. }
  18. public override void MissDataInit(TrendChartData TrendChartCofig, int i)
  19. {
  20. DefaultMissDataInit(TrendChartCofig, i);
  21. }
  22. public override string GetMissData(MissDataType missDataType)
  23. {
  24. return GetDefaultMissData(missDataType);
  25. }
  26. public override bool SetItemValue(TEntity entity, TEntity lastentity)
  27. {
  28. _itemIndex = new int[this._itemConfig.ItemCount];
  29. return SetMultiValueAndMiss(entity, ref _itemIndex, ref this._localMiss);
  30. }
  31. public override bool SetItemValue(TEntity entity)
  32. {
  33. _itemIndex = new int[this._itemConfig.ItemCount];
  34. return SetMultiValueAndMiss(entity, ref _itemIndex, ref this._localMiss);
  35. }
  36. public override string GetFomartString(string fomart, ChartCssConfigInfo cssConfig = null)
  37. {
  38. var html = GetFomartHTML(fomart, cssConfig);
  39. var sp = new StringBuilder((html.Item1.Length + 40) * this._itemConfig.ItemCount);
  40. for (int i = 0; i < this._itemConfig.ItemCount; i++)
  41. {
  42. sp.Append(0 < this._itemIndex[i] ? GetHtml(true, html.Item1, GetlgroupAndColor(true, html.Item4), this._itemConfig.ItemString[i], i) : GetHtml(false, html.Item1, GetlgroupAndColor(false, html.Item4), _localMiss[i].ToString(), i));
  43. }
  44. return sp.ToString();
  45. }
  46. }
  47. }