Example #1
0
        private void SetBestFormat(FormulaCanvas Canvas, FormulaArea Area, int Start)
        {
            int k = Start;

            for (int i = 0; i < LabelValues.Length; i++)
            {
                double d = (LabelValues[i] / MultiplyFactor);
                k = FormulaHelper.TestBestFormat(d, k);
            }

            bool b = false;

            for (int i = 0; i < Area.FormulaDataArray.Count; i++)
            {
                FormulaRenderType frt = (Area.FormulaDataArray[i] as FormulaData).RenderType;
                if (frt == FormulaRenderType.STOCK)
                {
                    double d = GetLastValue(Canvas, Area, i);
                    if (!double.IsNaN(d))
                    {
                        k = FormulaHelper.TestBestFormat(d, k);
                        b = true;
                    }
                }
            }

            if (format != null && format.Length > 1 && !b)
            {
                format = "f" + format.Substring(1);
            }
            else
            {
                format = "f" + k;
            }
        }
Example #2
0
        public void SetAttr(string s)
        {
            try
            {
                this.RenderType = (FormulaRenderType)Enum.Parse(typeof(FormulaRenderType), s, true);
                return;
            }
            catch
            {
            }

            try
            {
                this.Dot = (FormulaDot)Enum.Parse(typeof(FormulaDot), s, true);
                return;
            }
            catch
            {
            }

            try
            {
                this.Align = (FormulaAlign)Enum.Parse(typeof(FormulaAlign), s, true);
                return;
            }
            catch
            {
            }

            try
            {
                this.Smoothing = (SmoothingMode)Enum.Parse(typeof(SmoothingMode), s, true);
                return;
            }
            catch
            {
            }

            try
            {
                this.VAlign = (VerticalAlign)Enum.Parse(typeof(VerticalAlign), s, true);
                return;
            }
            catch
            {
            }

            try
            {
                this.Transform = (Transform)Enum.Parse(typeof(Transform), s, true);
                return;
            }
            catch
            {
            }
            s = s.ToUpper();
            SetProperties(s);
        }
Example #3
0
        public void SetAttr(string s)
        {
            try
            {
                this.RenderType = (FormulaRenderType)Enum.Parse(typeof(FormulaRenderType), s, true);
            }
            catch
            {
            }
            return;

            try
            {
                this.Dot = (FormulaDot)Enum.Parse(typeof(FormulaDot), s, true);
            }
            catch
            {
            }
            return;

            try
            {
                this.Align = (FormulaAlign)Enum.Parse(typeof(FormulaAlign), s, true);
            }
            catch
            {
            }
            return;

            try
            {
                this.Smoothing = (SmoothingMode)Enum.Parse(typeof(SmoothingMode), s, true);
            }
            catch
            {
            }
            return;

            try
            {
                this.VAlign = (VerticalAlign)Enum.Parse(typeof(VerticalAlign), s, true);
            }
            catch
            {
            }
            return;

            try
            {
                this.Transform = (Easychart.Finance.Transform)Enum.Parse(typeof(Easychart.Finance.Transform), s, true);
            }
            catch
            {
            }
            s = s.ToUpper();
            if (s.StartsWith("COLOR"))
            {
                this.SetColor(s.Substring(5));
            }
            else if (s.StartsWith("WIDTH"))
            {
                this.SetWidth(s.Substring(5));
            }
            else if (s.StartsWith("LINETHICK"))
            {
                this.SetWidth(s.Substring(9));
            }
            else if (s.StartsWith("ALIGN"))
            {
                this.SetAlign(s.Substring(5));
            }
            else if (s.StartsWith("BRUSH"))
            {
                this.SetBrush(s.Substring(5));
            }
            else if (s.StartsWith("LABEL"))
            {
                this.SetLabel(s.Substring(5));
            }
            else if (s.StartsWith("VALIGN"))
            {
                this.SetVAlign(s.Substring(6));
            }
            else if (s.StartsWith("AXISMARGIN"))
            {
                this.SetAxisMargin(s.Substring(10));
            }
            else if (s.StartsWith("STYLE"))
            {
                this.SetStyle(s.Substring(5));
            }
        }
Example #4
0
        public void SetAttr(string s)
        {
            try
            {
                RenderType = (FormulaRenderType)Enum.Parse(typeof(FormulaRenderType), s, true);
                return;
            }
            catch
            {
            }

            try
            {
                Dot = (FormulaDot)Enum.Parse(typeof(FormulaDot), s, true);
                return;
            }
            catch
            {
            }

            try
            {
                Align = (FormulaAlign)Enum.Parse(typeof(FormulaAlign), s, true);
                return;
            }
            catch
            {
            }

            try
            {
                Smoothing = (SmoothingMode)Enum.Parse(typeof(SmoothingMode), s, true);
                return;
            }
            catch
            {
            }

            try
            {
                VAlign = (VerticalAlign)Enum.Parse(typeof(VerticalAlign), s, true);
                return;
            }
            catch
            {
            }

            try
            {
                Transform = (Transform)Enum.Parse(typeof(Transform), s, true);
            }
            catch
            {
            }

            string su = s.ToUpper();

            if (su == "SAMECOLOR")
            {
                SameColor = true;
            }
            else if (su.StartsWith("COLOR"))
            {
                SetColor(s.Substring(5), false);
            }
            else if (su.StartsWith("UPCOLOR"))
            {
                SetColor(s.Substring(7), false);
            }
            else if (su.StartsWith("DOWNCOLOR"))
            {
                SetColor(s.Substring(9), true);
            }
            else if (su.StartsWith("WIDTH"))
            {
                SetWidth(s.Substring(5));
            }
            else if (su.StartsWith("LINETHICK"))
            {
                SetWidth(s.Substring(9));
            }
            else if (su.StartsWith("ALIGN"))
            {
                SetAlign(s.Substring(5));
            }
            else if (su.StartsWith("BRUSH"))
            {
                SetBrush(s.Substring(5));
            }
            else if (su.StartsWith("LABEL"))
            {
                SetLabel(s.Substring(5));
            }
            else if (su.StartsWith("VALIGN"))
            {
                SetVAlign(s.Substring(6));
            }
            else if (su.StartsWith("AXISMARGIN"))
            {
                SetAxisMargin(s.Substring(10));
            }
            else if (su.StartsWith("STYLE"))
            {
                SetStyle(s.Substring(5));
            }
            else if (su.StartsWith("FONT"))
            {
                SetFont(s.Substring(4));
            }
            else if (su.StartsWith("HIGH"))
            {
                SetPercent(s.Substring(4), true);
            }
            else if (su.StartsWith("LOW"))
            {
                SetPercent(s.Substring(3), false);
            }
            else if (su.StartsWith("ALPHA"))
            {
                SetAlpha(s.Substring(5));
            }
            else if (su.StartsWith("YLABEL"))
            {
                LastValueInAxis = true;
            }
            else if (su == "VALUETEXT.NONE" || su == "NOVALUELABEL")
            {
                //TextInvisible = true;
                ValueTextMode = ValueTextMode.None;
            }
            else if (su == "VALUETEXT.TEXTONLY")
            {
                ValueTextMode = ValueTextMode.TextOnly;
            }
            else if (su == "VALUETEXT.VALUEONLY")
            {
                ValueTextMode = ValueTextMode.ValueOnly;
            }
            else if (su == "HORIZONTAL")
            {
                Horizontal = true;
            }
        }