DataPointMananer.cs 1.7 KB

12345678910111213141516171819202122232425262728293031323334353637383940414243444546474849505152535455
  1. using IndexFormula.Finance.DataProvider;
  2. using IndexFormula.Finance.Win;
  3. using MuchInfo.Chart.Data.EnumTypes;
  4. using MuchInfo.Chart.Data.Interfaces;
  5. using System;
  6. using System.Collections.Generic;
  7. namespace MuchInfo.Chart.DataAdapter
  8. {
  9. public class DataPointMananer : CacheDataManagerBase
  10. {
  11. private IDataService _dataService;
  12. private ChartWinControl _winChart;
  13. private CycleType _cycleType;
  14. private TimeSpan _timeSpan;
  15. private List<Data.Interfaces.IBarDataPoint> _iBarDataPoints;
  16. public DataPointMananer(ChartWinControl chart)
  17. {
  18. _dataService = new DataService();
  19. _winChart = chart;
  20. }
  21. public override IDataProvider GetData(string Code, int Count)
  22. {
  23. var dataProvider = _dataService.DataPointConvert(_iBarDataPoints, _cycleType, _timeSpan, this);
  24. dataProvider.SetStringData("Code", "XAU2");
  25. return dataProvider;
  26. }
  27. /// <summary>
  28. /// 设置数据源
  29. /// </summary>
  30. /// <param name="barDataPoints">数据源</param>
  31. public void SetDataSource(List<Data.Interfaces.IBarDataPoint> barDataPoints, CycleType cycleType, TimeSpan timeSpan)
  32. {
  33. _iBarDataPoints = barDataPoints;
  34. _cycleType = cycleType;
  35. _timeSpan = timeSpan;
  36. this._winChart.Symbol = "XAU2";
  37. _winChart.Skin = "BlackWhite";
  38. _winChart.BindData();
  39. _winChart.NeedRefresh();
  40. }
  41. /// <summary>
  42. /// 更新Tick数据
  43. /// </summary>
  44. /// <param name="barDataPoint">BarPoint</param>
  45. public void UpdatePoint(IBarDataPoint barDataPoint)
  46. {
  47. _winChart.NeedRefresh();
  48. }
  49. }
  50. }