Пример #1
0
 public override Distance Distance(int x, double y)
 {
     var d = new Distance();
     var bar = this.series[this.pad.GetDateTime(x), IndexOption.Null];
     d.DX = 0;
     d.DY = bar.Low <= y && y <= bar.High ? 0 : d.DY;
     if (d.DX == double.MaxValue || d.DY == double.MaxValue)
         return null;
     d.ToolTipText = string.Format(ToolTipFormat, this.series.Name, this.series.Description, bar.DateTime, bar.High, bar.Low, bar.Open, bar.Close, bar.Volume);
     return d;
 }
Пример #2
0
 public Distance Distance(int x, double y)
 { 
     var d = new Distance();
     var dateTime = this.Pad.GetDateTime(x);
     double y1 = this.ray.Y;
     d.X = (double)x;
     d.Y = y1;
     int num = this.Pad.ClientX(this.chartFirstDate);
     int x2 = this.Pad.X2;
     d.DX = num > x || x2 < x ? double.MaxValue : 0.0;
     d.DY = Math.Abs(y - this.ray.Y);
     if (d.DX == double.MaxValue || d.DY == double.MaxValue)
         return null;
     d.ToolTipText = string.Format(ToolTipFormat, "Ray", this.ray.Name, dateTime, this.ray.Y);
     return d;
 }
Пример #3
0
 public Distance Distance(int x, double y)
 {
     var d = new Distance();
     int index = this.pad.Series.GetIndex(this.fill.DateTime, IndexOption.Prev);
     d.X = this.pad.ClientX(this.pad.Series.GetDateTime(index));
     d.Y = this.fill.Price;
     d.DX = Math.Abs(x - d.X);
     d.DY = Math.Abs(y - d.Y);
     if (this.fill.DateTime.Second == 0 && this.fill.DateTime.Minute == 0 && this.fill.DateTime.Hour == 0)
         d.ToolTipText = string.Format(ToolTipFormat, this.fill.Side, this.fill.Instrument.Symbol, this.fill.Qty, this.fill.Price, this.fill.DateTime.ToShortDateString(), this.fill.Text);
     else
         d.ToolTipText = string.Format(ToolTipFormat, this.fill.Side, this.fill.Instrument.Symbol, this.fill.Qty, this.fill.Price, this.fill.DateTime, this.fill.Text);
     return d;
 }
Пример #4
0
        public override Distance Distance(int x, double y)
        {
            var d = new Distance();
            DateTime dateTime = this.pad.GetDateTime(x);
            double num = 0.0;
            if (Option == SearchOption.ExactFirst)
            {
                if (!this.series.Contains(dateTime))
                    return null;
                num = this.series[dateTime];
            }
            if (Option == SearchOption.Next)
            {
                if (this.series.LastDateTime < dateTime.AddTicks(1))
                    return null;
                num = this.series[dateTime.AddTicks(1), SearchOption.Next];
            }
            d.X = x;
            d.Y = num;
            d.DX = 0;
            d.DY = Math.Abs(y - num);

            if (d.DX == double.MaxValue || d.DY == double.MaxValue)
                return null;
            d.ToolTipText = string.Format(ToolTipFormat, this.series.Name, this.series.Description, dateTime, d.Y);
            return d;
        }
Пример #5
0
        public Distance Distance(int x, double y)
        {
            if (this.chartFirstDate > this.lastDate || this.chartLastDate < this.firstDate)
                return null;

            var d = new Distance();
            DateTime dateTime = this.pad.GetDateTime(x);
            double num;
            if (dateTime == this.chartFirstDate)
                num = this.line.Y1;
            else if (dateTime == this.chartLastDate)
            {
                num = this.line.Y2;
            }
            else
            {
                if (dateTime.Ticks > Math.Max(this.line.X1.Ticks, this.line.X2.Ticks) || dateTime.Ticks < Math.Min(this.line.X1.Ticks, this.line.X2.Ticks))
                    return (Distance) null;
                num = this.GetLineValueAt(this.pad.MainSeries.GetIndex(dateTime, IndexOption.Null));
            }
            d.X = x;
            d.Y = num;
            d.DX = 0.0;
            d.DY = Math.Abs(y - num);
            if (d.DX == double.MaxValue || d.DY == double.MaxValue)
                return  null;
            d.ToolTipText = string.Format(ToolTipFormat, "Line", this.line.Name, dateTime, num);
            return d;
        }