Example #1
0
        public override void loadData()
        {
            if (base.SelectedItemData == null)
            {
                return;
            }
            if (string.IsNullOrEmpty(base.SelectedItemData.Code))
            {
                return;
            }

            string itemCode = base.SelectedItemData.Code;

            var sourceDatas = PPContext.Instance.ClientContext.GetCandleSourceDataOrderByAsc(
                itemCode
                , base.timeInterval);

            if (sourceDatas == null || sourceDatas.Count == 0)
            {
                return;
            }

            //표시할 갯수를 맞춘다.
            RemoveSourceData(sourceDatas);
            //국내지수인 경우 시간갭이 크기 때문에.. 전일종가를 당일시가로 해야한다.
            //SetChangeOpenPrice(itemCode, sourceDatas);

            var averageDatas = PPUtils.GetAverageDatas(itemCode, sourceDatas, 9);
            //var averageDatas = PPUtils.GetBalancedAverageDatas(itemCode, sourceDatas, 9);
            //var averageDatas = PPUtils.GetAccumulatedAverageDatas(itemCode, sourceDatas, 9);
            List <S_CandleItemData> rcSDatas1, rcSDatas2;

            if (IsUseDetailCal)
            {
                if (IsUseAverageData)
                {
                    rcSDatas1 = PPUtils.GetRecreateSecondDatas2(itemCode, averageDatas, 5, false);
                    rcSDatas2 = PPUtils.GetRecreateSecondDatas2(itemCode, averageDatas, 5, true);
                }
                else
                {
                    rcSDatas1 = PPUtils.GetRecreateSecondDatas2(itemCode, sourceDatas, 5, false);
                    rcSDatas2 = PPUtils.GetRecreateSecondDatas2(itemCode, sourceDatas, 5, true);
                }
            }
            else
            {
                if (IsUseAverageData)
                {
                    rcSDatas1 = PPUtils.GetRecreateSecondDatas(itemCode, averageDatas, 5, false);
                    rcSDatas2 = PPUtils.GetRecreateSecondDatas(itemCode, averageDatas, 5, true);
                }
                else
                {
                    rcSDatas1 = PPUtils.GetRecreateSecondDatas(itemCode, sourceDatas, 5, false);
                    rcSDatas2 = PPUtils.GetRecreateSecondDatas(itemCode, sourceDatas, 5, true);
                }
            }

            sourceDatas = PPUtils.GetCutDatas(sourceDatas, rcSDatas1[0].DTime);

            chart.LoadDataAndApply(itemCode, sourceDatas, base.timeInterval, 9);
            chart2.LoadDataAndApply(itemCode, rcSDatas1, base.timeInterval, 9);
            chart3.LoadDataAndApply(itemCode, rcSDatas2, base.timeInterval, 9);

            //chart2.SetDataPointColor(Color.Black, Color.Black, Color.Black);
            //chart3.SetDataPointColor(Color.Black, Color.Black, Color.Black);
        }