Exemplo n.º 1
0
        public FormulaSkin()
        {
            AxisX  = new FormulaAxisX();
            axisXs = new AxisXCollection();
            axisXs.Add(AxisX);

            AxisY = new FormulaAxisY();
            Back  = new FormulaBack();
        }
Exemplo n.º 2
0
 public void CopyFrom(FormulaAxisX fax)
 {
     this.Visible            = fax.Visible;
     this.DateFormatProvider = fax.DateFormatProvider;
     this.AutoScale          = fax.AutoScale;
     this.Format             = fax.Format;
     this.MajorTick          = (FormulaTick)fax.MajorTick.Clone();
     this.MinorTick          = (FormulaTick)fax.MinorTick.Clone();
     this.Back           = (FormulaBack)fax.Back.Clone();
     this.LabelFont      = (Font)fax.LabelFont.Clone();
     this.LabelBrush     = (Brush)fax.LabelBrush.Clone();
     this.AxisLabelAlign = fax.AxisLabelAlign;
     this.DataCycle      = fax.DataCycle;
 }
Exemplo n.º 3
0
 /// <summary>
 /// Copy attribute from another FormulaAxisX
 /// </summary>
 /// <param name="fax"></param>
 public void CopyFrom(FormulaAxisX fax)
 {
     visible            = fax.visible;
     DateFormatProvider = fax.DateFormatProvider;
     autoScale          = fax.autoScale;
     format             = fax.format;
     majorTick          = fax.majorTick.Clone();
     minorTick          = fax.minorTick.Clone();
     back           = (FormulaBack)fax.back.Clone();
     labelFont      = (Font)fax.labelFont.Clone();
     labelBrush     = fax.labelBrush.Clone();
     axisLabelAlign = fax.axisLabelAlign;
     DataCycle      = fax.DataCycle;
     cursorFormat   = fax.cursorFormat;
     height         = fax.height;
 }
Exemplo n.º 4
0
 public FormulaSkin()
 {
     Brush[] brushArray = new Brush[3];
     brushArray[2]       = Brushes.Blue;
     this.BarBrushes     = brushArray;
     this.NameBrush      = new SolidBrush(Color.Black);
     this.NameFont       = new Font("Verdana", 7f);
     this.TextFont       = new Font("Verdana", 7f);
     this.CursorPen      = new Pen(Color.Black);
     this.ShowValueLabel = true;
     this.AxisX          = new FormulaAxisX();
     this.AxisXs         = new AxisXCollection();
     this.AxisXs.Add(this.AxisX);
     this.AxisY = new FormulaAxisY();
     this.Back  = new FormulaBack();
 }
Exemplo n.º 5
0
 public void Remove(FormulaAxisX value)
 {
     List.Remove(value);
 }
Exemplo n.º 6
0
 public virtual int Add(FormulaAxisX fax)
 {
     return(List.Add(fax));
 }
Exemplo n.º 7
0
 public virtual void Add(FormulaAxisX fax)
 {
     base.List.Add(fax);
 }
Exemplo n.º 8
0
        public void DrawXAxisTick(FormulaCanvas Canvas, double[] Date, FormulaData fdDate, PointF[] pfs, FormulaAxisX fax, ExchangeIntraday ei)
        {
            if (DataCycle == null)
            {
                return;
            }

            try
            {
                int      LastCycle   = -1;
                int      NowCycle    = 0;
                string   LastExtDate = "";
                string   NowExtDate;
                int      LastX     = -10000;
                int      LastIndex = -1;
                Graphics g         = Canvas.CurrentGraph;

                double DateSpan = 0;
                if (Date.Length > 0)
                {
                    DateSpan = Date[Date.Length - 1] - Date[0];
                }

                double[] SeqDate = Date;
                if (ei != null && ei.NativeCycle)
                {
                    SeqDate = new double[Date.Length];
                    for (int i = 0; i < SeqDate.Length; i++)
                    {
                        SeqDate[i] = (int)Date[i] + ei.OneDayTime(Date[i]);
                    }
                }

                ArrayList alTick = new ArrayList();
                Font      F      = fax.LabelFont;
                Pen       LP     = LinePen.GetPen();
                Pen       TP     = TickPen.GetPen();
                for (int i = pfs.Length - 1; i >= 0; i--)
                {
                    int      DateIndex = Date.Length - 1 - Math.Max(0, Canvas.Start) - i;
                    double   d         = Date[DateIndex];
                    DateTime D         = DateTime.FromOADate(d);
                    NowCycle = DataCycle.GetSequence(SeqDate[DateIndex]);

                    if (NowCycle != LastCycle)
                    {
                        PointF P = pfs[i];
                        LastCycle = NowCycle;
                        if (ShowLine)
                        {
                            int B = Canvas.Rect.Bottom;
                            if (!fax.Visible)
                            {
                                B = Canvas.FrameRect.Bottom;
                            }
                            g.DrawLine(LP, P.X, Canvas.FrameRect.Top, P.X, B);
                        }

                        if (fax.Visible && ShowTick)
                        {
                            int TickHeight = TickWidth;
                            if (FullTick)
                            {
                                TickHeight = fax.Rect.Height;
                            }
                            if (Inside)
                            {
                                TickHeight = -TickHeight;
                            }
                            g.DrawLine(TP, P.X, fax.Rect.Top, P.X, TickHeight + fax.Rect.Top);
                        }

                        string s  = D.ToString(Format, DateFormatProvider);
                        int    i1 = s.IndexOf('{');
                        int    i2 = s.IndexOf('}');
                        if (i2 > i1)
                        {
                            NowExtDate = s.Substring(i1 + 1, i2 - i1 - 1);
                            if (NowExtDate != LastExtDate)
                            {
                                if (NowExtDate.StartsWith("$"))
                                {
                                    s = s.Remove(i2, s.Length - i2).Remove(i1, 2);
                                }
                                else
                                {
                                    s = s.Remove(i1, 1).Remove(i2 - 1, 1);
                                }
                            }
                            else
                            {
                                s = s.Substring(0, i1) + s.Substring(i2 + 1);
                            }
                            LastExtDate = NowExtDate;
                        }

                        float LabelWidth = g.MeasureString(s, F).Width;
                        float LabelX     = P.X;

                        switch (fax.AxisLabelAlign)
                        {
                        case AxisLabelAlign.TickCenter:
                            LabelX -= LabelWidth / 2;
                            break;

                        case AxisLabelAlign.TickLeft:
                            LabelX -= LabelWidth;
                            break;
                        }
                        if (LabelX < fax.Rect.Left)
                        {
                            LabelX = fax.Rect.Left;
                        }

                        if (fax.Visible && ShowText /*&& LastX+MinimumPixel<LabelX*/)
                        {
                            if (ei == null || ei.ShowFirstXLabel || i < pfs.Length - 1 || DateSpan > 1)
                            {
                                alTick.Add(new object[] { s, LabelX, LabelWidth, d, LastX + MinimumPixel < LabelX });
                                //g.DrawString(s,F,fax.LabelBrush,LabelX,fax.Rect.Top);
                                LastX = (int)(LabelX + LabelWidth);
                            }
                            LastIndex = i;
                        }
                    }             //if (NowCycle!=LastCycle)
                }                 //for

                //Second pass
                for (int i = 0; i < alTick.Count; i++)
                {
                    object[] os = (object[])alTick[i];
                    if (!(bool)os[4])
                    {
                        if ((int)(double)((object[])alTick[i - 1])[3] == (int)(double)((object[])alTick[i])[3])
                        {
                            alTick.RemoveAt(i);
                        }
                        else
                        {
                            alTick.RemoveAt(i - 1);
                        }
                        i--;
                    }
                }

                //Third pass
                Brush lb = fax.LabelBrush.GetBrush();
                for (int i = 0; i < alTick.Count; i++)
                {
                    object[] os = (object[])alTick[i];
                    g.DrawString((string)os[0], F, lb, (float)os[1], fax.Rect.Top);
                }
            }
            catch
            {
            }
        }
Exemplo n.º 9
0
        public void DrawXAxisTick(FormulaCanvas Canvas, double[] Date, FormulaData fdDate, PointF[] pfs, FormulaAxisX fax, ExchangeIntraday ei)
        {
            if (this.DataCycle != null)
            {
                int      num          = 0;
                int      sequence     = 0;
                string   str          = "";
                int      num3         = -10000;
                int      num4         = -1;
                Graphics currentGraph = Canvas.CurrentGraph;
                double   num5         = 0.0;
                if (Date.Length > 0)
                {
                    num5 = Date[Date.Length - 1] - Date[0];
                }
                double[] numArray = Date;
                if ((ei != null) && ei.NativeCycle)
                {
                    numArray = new double[Date.Length];
                    for (int j = 0; j < numArray.Length; j++)
                    {
                        numArray[j] = ((int)Date[j]) + ei.OneDayTime(Date[j]);
                    }
                }
                for (int i = pfs.Length - 1; i >= 0; i--)
                {
                    int      index = ((Date.Length - 1) - Canvas.Start) - i;
                    double   d     = Date[index];
                    DateTime time  = DateTime.FromOADate(d);
                    sequence = this.DataCycle.GetSequence(numArray[index]);
                    if (sequence != num)
                    {
                        PointF tf = pfs[i];
                        num = sequence;
                        if (this.ShowLine)
                        {
                            int bottom = Canvas.Rect.Bottom;
                            if (!fax.Visible)
                            {
                                bottom = Canvas.FrameRect.Bottom;
                            }
                            currentGraph.DrawLine(this.LinePen, tf.X, (float)Canvas.FrameRect.Top, tf.X, (float)bottom);
                        }
                        if (fax.Visible && this.ShowTick)
                        {
                            int tickWidth = this.TickWidth;
                            if (this.FullTick)
                            {
                                tickWidth = fax.Rect.Height;
                            }
                            if (this.Inside)
                            {
                                tickWidth = -tickWidth;
                            }
                            currentGraph.DrawLine(this.TickPen, tf.X, (float)fax.Rect.Top, tf.X, (float)(tickWidth + fax.Rect.Top));
                        }
                        string text       = time.ToString(this.Format, this.DateFormatProvider);
                        int    startIndex = text.IndexOf('{');
                        int    num13      = text.IndexOf('}');
                        if (num13 > startIndex)
                        {
                            string str2 = text.Substring(startIndex + 1, (num13 - startIndex) - 1);
                            if (str2 != str)
                            {
                                text = text.Remove(startIndex, 1).Remove(num13 - 1, 1);
                            }
                            else
                            {
                                text = text.Substring(0, startIndex) + text.Substring(num13 + 1);
                            }
                            str = str2;
                        }
                        Font  labelFont = fax.LabelFont;
                        float width     = currentGraph.MeasureString(text, labelFont).Width;
                        float x         = tf.X;
                        switch (fax.AxisLabelAlign)
                        {
                        case AxisLabelAlign.TickCenter:
                            x -= width / 2f;
                            break;

                        case AxisLabelAlign.TickLeft:
                            x -= width;
                            break;
                        }
                        if (x < fax.Rect.Left)
                        {
                            x = fax.Rect.Left;
                        }
                        if ((fax.Visible && this.ShowText) && ((num3 + this.MinimumPixel) < x))
                        {
                            if (((ei == null) || ei.ShowFirstXLabel) || ((i < (pfs.Length - 1)) || (num5 > 1.0)))
                            {
                                currentGraph.DrawString(text, labelFont, fax.LabelBrush, x, (float)fax.Rect.Top);
                                num3 = (int)(x + width);
                            }
                            num4 = i;
                        }
                    }
                }
            }
        }