Exemplo n.º 1
0
        static public FormulaChart ShowObjectOnChart(FormulaChart fc, TextReader reader, DataManagerBase dmb,
                                                     bool ObjectLayout)
        {
            ObjectManager om = FromChart(fc);

            om.ReadXml(reader, false);
            if (om.startTime != 0.0)
            {
                fc.StartTime = DateTime.FromOADate(om.startTime);
            }
            if (om.endTime != 0.0)
            {
                fc.EndTime = DateTime.FromOADate(om.endTime);
            }

            if (ObjectLayout && om.indicators != null)
            {
                fc.Areas.Clear();
                if (om.indicators != null)
                {
                    fc.StringsToArea(om.indicators.Split(';'));
                }
                fc.SetAreaPercent(om.areaPercent);
                fc.Rect = new Rectangle(0, 0, om.width, om.height);
            }
            om.SetCanvas(om.Canvas);
            if (om.skin != null)
            {
                fc.SetSkin(om.skin);
            }

            fc.StickRenderType = om.stickRenderType;
            if (om.symbol != null && om.symbol != "")
            {
                //if (om.latestTime!=0.0)
                //	dmb.EndTime = DateTime.FromOADate(om.latestTime);
                CommonDataProvider cdp = (CommonDataProvider)dmb[om.symbol];
                cdp.DataCycle   = DataCycle.Parse(om.currentDataCycle);
                fc.DataProvider = cdp;
            }
            FormulaArea fa = fc.MainArea;

            if (fa != null)
            {
                fa.StockRenderType = om.stockRenderType;
            }

            if (om.minPrice != 0)
            {
                if (fa != null)
                {
                    fa.AxisY.MinY      = om.minPrice;
                    fa.AxisY.MaxY      = om.maxPrice;
                    fa.AxisY.AutoScale = false;
                }
            }
            return(fc);
        }
Exemplo n.º 2
0
        public static ObjectManager ReadXml(TextReader reader, IObjectCanvas Canvas)
        {
            XmlSerializer xs = new XmlSerializer(typeof(ObjectManager));
            ObjectManager om = (ObjectManager)xs.Deserialize(reader);

            if (Canvas != null)
            {
                om.SetCanvas(Canvas);
                om.Designer.Invalidate();
            }
            return(om);
        }