Exemple #1
0
        public void DrawCursor(Graphics g, FormulaChart fc, FormulaArea Area, float X)
        {
            if (!this.LastCursorRect.IsEmpty)
            {
                fc.RestoreMemBmp(g, this.LastCursorRect);
            }
            FormulaLabel label     = Area.Labels[2];
            int          cursorPos = fc.CursorPos;

            if ((Object)fdDate != null && cursorPos >= 0)
            {
                if (cursorPos < this.fdDate.Length)
                {
                    string text = DateTime.FromOADate(this.fdDate[cursorPos]).ToString(this.CursorFormat,
                                                                                       DateTimeFormatInfo.InvariantInfo);
                    SizeF      ef   = g.MeasureString(text, this.LabelFont);
                    RectangleF rect = new RectangleF(X - fc.Rect.X, (float)this.Rect.Y, ef.Width,
                                                     (float)(this.Rect.Height - 1));
                    this.LastCursorRect = rect;
                    this.LastCursorRect.Inflate(2f, 1f);
                    rect.Offset((PointF)fc.Rect.Location);
                    label.DrawString(g, text, this.LabelFont, label.TextBrush, VerticalAlign.Bottom, FormulaAlign.Left,
                                     rect, false);
                }
            }
        }
 public void SetVisible(FormulaChart fc)
 {
     for (int i = 0; i < this.Visible.Length; i++)
     {
         fc.SetAxisXVisible(i, this.Visible[i]);
     }
 }
 public void SetMinorLine(FormulaChart fc)
 {
     for (int i = 0; i < this.ShowMinorLine.Length; i++)
     {
         fc.SetAxisXShowMinorLine(i, this.ShowMinorLine[i]);
     }
 }
Exemple #4
0
        public void DrawCursor(Graphics g, FormulaChart fc, FormulaArea Area, float Y, double d)
        {
            if (!this.LastCursorRect.IsEmpty)
            {
                fc.RestoreMemBmp(g, this.LastCursorRect);
            }
            FormulaLabel label = Area.Labels[2];
            string       text  = d.ToString(this.Format);
            SizeF        ef    = g.MeasureString(text, this.LabelFont);
            RectangleF   rect  = new RectangleF((float)this.Rect.Left, Y - fc.Rect.Y, (this.Rect.Width - 1) - this.Back.RightPen.Width, ef.Height);

            this.LastCursorRect = rect;
            this.LastCursorRect.Inflate(2f, 1f);
            rect.Offset((PointF)fc.Rect.Location);
            label.DrawString(g, text, this.LabelFont, label.TextBrush, VerticalAlign.Bottom, FormulaAlign.Left, rect, false);
        }
Exemple #5
0
        public static FormulaChart CreateChart(string Indicators, string Overlays, IDataProvider DataProvider, string Skin)
        {
            FormulaChart chart = new FormulaChart();

            chart.AddAreas(Indicators);
            chart.AddOverlays(Overlays);
            if (DataProvider != null)
            {
                chart.DataProvider = DataProvider;
            }
            if ((Skin != null) && (Skin != ""))
            {
                chart.SetSkin(Skin);
            }
            return(chart);
        }
Exemple #6
0
 public void Bind(FormulaChart fc)
 {
     foreach (FormulaArea area in fc.Areas)
     {
         if (area.AxisXs.Count != this.AxisXs.Count)
         {
             area.AxisXs.Clear();
             for (int j = 0; j < this.AxisXs.Count; j++)
             {
                 area.AxisXs.Add(new FormulaAxisX());
             }
             if (this.AxisXs.Count > 0)
             {
                 area.AxisX = area.AxisXs[0];
             }
         }
         for (int i = 0; i < this.AxisXs.Count; i++)
         {
             area.AxisXs[i].CopyFrom(this.AxisXs[i]);
         }
         foreach (FormulaAxisY sy in area.AxisYs)
         {
             sy.CopyFrom(this.AxisY);
         }
         area.Back             = (FormulaBack)this.Back.Clone();
         area.Colors           = (Color[])this.Colors.Clone();
         area.LinePen          = (Pen)this.LinePen.Clone();
         area.BarPens          = (Pen[])this.BarPens.Clone();
         area.BarBrushes       = (Brush[])this.BarBrushes.Clone();
         area.NameBrush        = (Brush)this.NameBrush.Clone();
         area.NameFont         = (Font)this.NameFont.Clone();
         area.TextFont         = (Font)this.TextFont.Clone();
         area.DrawVolumeAsLine = this.DrawVolumeAsLine;
         area.StockRenderType  = this.StockRenderType;
     }
     fc.CursorPen          = this.CursorPen;
     fc.ShowDateInLastArea = this.ShowDateInLastArea;
     fc.ShowValueLabel     = this.ShowValueLabel;
     fc.AllXFormats        = this.AllXFormats;
 }
Exemple #7
0
 public void DrawCursor(Graphics g, FormulaChart fc, FormulaArea Area, float Y)
 {
     this.DrawCursor(g, fc, Area, Y, this.GetValueFromY(Y - fc.Rect.Y));
 }