protected override void OnMouseDown(List <SeriesEditParameter> parameters,
                                            MouseEventArgs e, Keys modifierKeys, out IChartInteractiveObject objectToEdit)
        {
            objectToEdit = null;
            if (e.Button != MouseButtons.Left)
            {
                return;
            }
            var pointD = Chart.Owner.MouseToWorldCoords(e.X, e.Y);
            var index  = (int)Math.Round(pointD.X);

            if (index >= 0 && index < Chart.StockPane.StockSeries.Data.Count)
            {
                pointD.Y = (double)(Chart.StockPane.StockSeries.Data[index].low);
            }

            var incompleted = data.Find(s => s.Completed == false);

            if (incompleted != null)
            {
                incompleted.AddPoint(pointD.X, pointD.Y);
                MakeProjections();
            }
            else
            {
                var span = new FiboSpan(this);
                span.AddPoint(pointD.X, pointD.Y);
                if (Owner.Owner.Owner.AdjustObjectColorsOnCreation)
                {
                    span.AjustColorScheme(Owner.Owner.Owner);
                }
                data.Add(span);
            }
        }
        public override IChartInteractiveObject LoadObject(XmlElement objectNode, CandleChartControl owner, bool trimObjectsOutOfHistory = false)
        {
            var obj = new FiboSpan(this);

            obj.LoadFromXML(objectNode, owner);
            data.Add(obj);
            return(obj);
        }
        public void DrawSpan(Graphics g, RectangleD worldRect, Rectangle canvasRect,
                             FiboSpan span, Brush brushWhite, PenStorage penStorage)
        {
            if (span.points.Count == 0)
            {
                return;
            }
            var pen = penStorage.GetPen(span.Color);
            var ptA = Conversion.WorldToScreen(new PointD(span.points[0].X, span.points[0].Y),
                                               worldRect, canvasRect);

            if (span.points.Count == 2)
            {
                var ptB = Conversion.WorldToScreen(new PointD(span.points[1].X, span.points[1].Y),
                                                   worldRect, canvasRect);
                g.DrawLine(pen, ptA.ToPointF(), ptB.ToPointF());
                DrawMarker(g, pen, brushWhite, ptB);
            }
            DrawMarker(g, pen, brushWhite, ptA);
        }
        protected override void OnMouseDown(List<SeriesEditParameter> parameters,
            MouseEventArgs e, Keys modifierKeys, out IChartInteractiveObject objectToEdit)
        {
            objectToEdit = null;
            if (e.Button != MouseButtons.Left) return;
            var pointD = Chart.Owner.MouseToWorldCoords(e.X, e.Y);
            var index = (int)Math.Round(pointD.X);
            if (index >= 0 && index < Chart.StockPane.StockSeries.Data.Count)
                pointD.Y = (double)(Chart.StockPane.StockSeries.Data[index].low);

            var incompleted = data.Find(s => s.Completed == false);
            if (incompleted != null)
            {
                incompleted.AddPoint(pointD.X, pointD.Y);
                MakeProjections();
            }
            else
            {
                var span = new FiboSpan(this);
                span.AddPoint(pointD.X, pointD.Y);
                if (Owner.Owner.Owner.AdjustObjectColorsOnCreation)
                    span.AjustColorScheme(Owner.Owner.Owner);
                data.Add(span);
            }
        }
 public override IChartInteractiveObject LoadObject(XmlElement objectNode, CandleChartControl owner, bool trimObjectsOutOfHistory = false)
 {
     var obj = new FiboSpan(this);
     obj.LoadFromXML(objectNode, owner);
     data.Add(obj);
     return obj;
 }
 public void DrawSpan(Graphics g, RectangleD worldRect, Rectangle canvasRect, 
     FiboSpan span, Brush brushWhite, PenStorage penStorage)
 {
     if (span.points.Count == 0) return;
     var pen = penStorage.GetPen(span.Color);
     var ptA = Conversion.WorldToScreen(new PointD(span.points[0].X, span.points[0].Y),
                                                         worldRect, canvasRect);
     if (span.points.Count == 2)
     {
         var ptB = Conversion.WorldToScreen(new PointD(span.points[1].X, span.points[1].Y),
                                                         worldRect, canvasRect);
         g.DrawLine(pen, ptA.ToPointF(), ptB.ToPointF());
         DrawMarker(g, pen, brushWhite, ptB);
     }
     DrawMarker(g, pen, brushWhite, ptA);
 }