Exemple #1
0
        private void InitInteractiveSimpleLine(IGraphPane pane)
        {
            var id = Value.Data.GetId();

            m_interactiveSimpleLine = (IInteractiveSimpleLine)pane.GetInteractiveObject(id);
            var         intColor = ColorParser.Parse(Color);
            MarketPoint marketPosition;

            if (m_interactiveSimpleLine != null)
            {
                marketPosition = new MarketPoint(m_interactiveSimpleLine.MarketPosition.X, Value.Value);
                if (m_interactiveSimpleLine.PaneSides == PaneSide && m_interactiveSimpleLine.Color == intColor)
                {
                    m_interactiveSimpleLine.Thickness      = Thickness;
                    m_interactiveSimpleLine.MarketPosition = marketPosition;
                    pane.AddUnremovableInteractiveObjectId(id);
                    return;
                }
                pane.RemoveInteractiveObject(id);
            }
            else
            {
                marketPosition = new MarketPoint(DateTime.UtcNow, Value.Value);
            }

            m_interactiveSimpleLine           = pane.AddInteractiveSimpleLine(id, PaneSide, false, intColor, InteractiveSimpleLineMode.Horizontal, marketPosition);
            m_interactiveSimpleLine.Thickness = Thickness;
        }
        private IInteractiveLine GetInteractiveLine(IGraphPane pane, IReadOnlyList <IDataBar> bars)
        {
            var minDate              = bars.First().Date;
            var maxDate              = bars.Last().Date;
            var interactiveLine      = (IInteractiveLine)pane.GetInteractiveObject(VariableId);
            var intColor             = ColorParser.Parse(Color);
            var firstMarketPosition  = new MarketPoint(FirstDateTime.Value, FirstValue.Value);
            var secondMarketPosition = new MarketPoint(SecondDateTime.Value, SecondValue.Value);

            if (interactiveLine != null)
            {
                interactiveLine.ExecutionDataBars = bars;
                CorrectMarketPointsEx(ref firstMarketPosition, ref secondMarketPosition, minDate, maxDate);

                if (interactiveLine.PaneSides == PaneSide && interactiveLine.Color == intColor && interactiveLine.Mode == Mode)
                {
                    pane.AddUnremovableInteractiveObjectId(VariableId);
                    interactiveLine.Thickness = Thickness;
                    interactiveLine.FirstPoint.MarketPosition  = firstMarketPosition;
                    interactiveLine.SecondPoint.MarketPosition = secondMarketPosition;
                    return(m_interactiveLine = interactiveLine);
                }
                pane.RemoveInteractiveObject(VariableId);
            }
            else
            {
                CorrectMarketPointsEx(ref firstMarketPosition, ref secondMarketPosition, minDate, maxDate);
            }

            m_interactiveLine                   = pane.AddInteractiveLine(VariableId, PaneSide, false, intColor, Mode, firstMarketPosition, secondMarketPosition);
            m_interactiveLine.Thickness         = Thickness;
            m_interactiveLine.ExecutionDataBars = bars;
            return(m_interactiveLine);
        }