Example #1
0
        private ChartItemCollection CreateChartItemCollection(ChartItemType type, IEnumerable <ChartItem> chartItems, CollectionId id, IPen pen1, IPen pen2)
        {
            ChartItemCollection coll = null;

            if (type == ChartItemType.Linear)
            {
                coll = new ChartItemCollection(id, chartItems, pen1, null, true);
            }
            else if (type == ChartItemType.Candle)
            {
                coll = new StockItemCollection(id, chartItems.OfType <StockItem>(), pen1, pen2, null);
            }
            else if (type == ChartItemType.Volumn)
            {
                coll = new VolumnItemCollection(id, chartItems.OfType <VolumnItem>(), pen1, pen2);
            }
            else if (type == ChartItemType.Time)
            {
                coll = new SymmetricChartItemCollection(id, chartItems, pen1, null, SymmetricCommonSettings.CNSettings2);
            }
            else if (type == ChartItemType.TimeVolumn)
            {
                coll = new SymmetricVolumnItemCollection(id, chartItems != null ? chartItems.OfType <VolumnItem>() : null, pen1, pen2, SymmetricCommonSettings.CNSettings2);
            }
            return(coll);
        }
Example #2
0
        public ChartItemCollection CreateEmptyTimeCollection(ChartItemType type, IPen pen1, IPen pen2, out StockTradeDetails std)
        {
            std = null;

            Stock s = null;

            if (type == ChartItemType.Timely)
            {
                s   = LoadStock(shareId);
                std = LoadDetailDatas();
                if (Stock.IsNullOrEmpty(s))
                {
                    return(null);
                }
            }

            CollectionId        id   = new CollectionId(shareId, GetMarketId());
            ChartItemCollection coll = null;

            switch (type)
            {
            case ChartItemType.Timely:
                var tColl = new SymmetricChartItemCollection(id, null, pen1, null, SymmetricCommonSettings.CNSettings2);
                tColl.StartValue = s.Items.Last().close;
                coll             = tColl;
                break;

            case ChartItemType.TimelyAverage:
                coll = new SymmetricChartItemCollection(id, null, pen1, null, SymmetricCommonSettings.CNSettings2);
                break;

            case ChartItemType.TimelyVolumn:
                coll = new SymmetricVolumnItemCollection(id, null, pen1, pen2, SymmetricCommonSettings.CNSettings2);
                break;

            default:
                break;
            }

            return(coll);
        }
Example #3
0
        public void CreateTime()
        {
            string id = "600100";

            StockVolumnList svList = timeLoader.GetStockItems(id);

            //Create collection id
            CollectionId collId = new CollectionId(id);
            //Create pens
            IPen raisePen = DrawingObjectFactory.CreatePen(Brushes.Red, 1);
            IPen fallPen  = DrawingObjectFactory.CreatePen(Brushes.Green, 1);
            //Create stock item collection
            SymmetricChartItemCollection stockColl = new SymmetricChartItemCollection(collId, svList.Prices, raisePen, null, SymmetricCommonSettings.CNSettings);

            //Set main collection
            priceControl.SetMainCollection(stockColl);
            //Create volumn item collection
            SymmetricVolumnItemCollection volumnColl = new SymmetricVolumnItemCollection(collId, svList.Volumns, raisePen, fallPen, SymmetricCommonSettings.CNSettings);

            //Set main collection
            volumnControl.SetMainCollection(volumnColl);
            //Connect two controls
            priceControl.AddConnection(volumnControl);
        }
Example #4
0
 private ChartItemCollection CreateChartItemCollection(ChartItemType type, IEnumerable<ChartItem> chartItems, CollectionId id, IPen pen1, IPen pen2)
 {
     ChartItemCollection coll = null;
     if (type == ChartItemType.Linear)
     {
         coll = new ChartItemCollection(id, chartItems, pen1, null, true);
     }
     else if (type == ChartItemType.Candle)
     {
         coll = new StockItemCollection(id, chartItems.OfType<StockItem>(), pen1, pen2, null);
     }
     else if (type == ChartItemType.Volumn)
     {
         coll = new VolumnItemCollection(id, chartItems.OfType<VolumnItem>(), pen1, pen2);
     }
     else if (type == ChartItemType.Time)
     {
         coll = new SymmetricChartItemCollection(id, chartItems, pen1, null, SymmetricCommonSettings.CNSettings2);
     }
     else if (type == ChartItemType.TimeVolumn)
     {
         coll = new SymmetricVolumnItemCollection(id, chartItems != null ? chartItems.OfType<VolumnItem>() : null, pen1, pen2, SymmetricCommonSettings.CNSettings2);
     }
     return coll;
 }