public void ChangeTime(double time) { int openDate = cache_Code.GetOpenDate(time); RealTimeDataBuilder_DayData dataBuilder = cache_RealTimeDataBuilder.GetCache(openDate); if (dataBuilder == null) { IDataCache_CodeDate cache_CodeDate = cache_Code.GetCache_CodeDate(openDate); dataBuilder = new RealTimeDataBuilder_DayData(cache_CodeDate, time); cache_RealTimeDataBuilder.AddCache(openDate, dataBuilder); } else { dataBuilder.ChangeTime(time); } realTimeDataBuilder = dataBuilder; }
public void ChangeTime(double time) { if (currentTime == time) { return; } //比如 20150531140500 //1分钟线可以正常显示 //日线需要将 int date = DaySplitter.GetTimeDate(time, dataCache_Code.GetOpenDateReader()); if (currentDate != date) { //TODO 将以前生成的klineChartBuilder_1Minute cache下来 this.currentDataCache_CodeDate = dataCache_Code.GetCache_CodeDate(date); this.klineChartBuilder_1Minute = new RealTimeDataBuilder_DayData(currentDataCache_CodeDate, time); this.currentDate = date; } int index = klineData.IndexOfTime(time); double t = klineData.Arr_Time[index]; IKLineData todayMinuteKLineData = klineChartBuilder_1Minute.MinuteKlineData; KLineBar currentMinuteChart = klineChartBuilder_1Minute.GetCurrentChart(); //TODO 这里最多只支持到日线,两日线或以上不支持 int startIndex; if (t == (int)t) { startIndex = 0; } else { startIndex = todayMinuteKLineData.IndexOfTime(t); } int endIndex = todayMinuteKLineData.IndexOfTime(currentMinuteChart.Time); IKLineBar currentChart = todayMinuteKLineData.GetAggrKLineBar(startIndex, endIndex - 1); KLineBarMerge.MergeTo((KLineBar)currentChart, currentMinuteChart); this.currentChart = currentChart; this.currentTime = time; }