CT 4.2 Chart Freeze Adding a Canvas

Created at 27 May 2022, 08:45
How’s your experience with the cTrader Platform?
Your feedback is crucial to cTrader's development. Please take a few seconds to share your opinion and help us improve your trading experience. Thanks!
ClickAlgo's avatar

ClickAlgo

Joined 05.02.2015

CT 4.2 Chart Freeze Adding a Canvas
27 May 2022, 08:45


Hi, 

I have noticed a break in functionality from CT 4.1, when you add a canvas to a chart for an indicator it freezes the chart and you cannot move it, I have added some code as an example.

 

namespace cAlgo
{
    [Indicator(AccessRights = AccessRights.None)]
    public class CanvasTest : Indicator
    {
        [Parameter(DefaultValue = "Hello world!")]
        public string Message { get; set; }

        [Output("Main")]
        public IndicatorDataSeries Result { get; set; }

        protected override void Initialize()
        {
             var blueRectangle = new Rectangle()
            {
                Width = 80,
                Height = 60,
                FillColor = Color.Blue,
                Left = 10,
                Top = 10
            };

            Canvas canvas = new();
            
            canvas.AddChild(blueRectangle);
            
            Chart.AddControl(canvas);
        }

        public override void Calculate(int index)
        {
            // Calculate value at specified index
            // Result[index] = 
        }
    }
}

 


@ClickAlgo
Replies

amusleh
27 May 2022, 09:05

Hi,

Thanks for reporting, we were able to reproduce it and it will be fixed on future releases.


@amusleh

whis.gg
27 May 2022, 10:14

I have noticed this as well, it's acting as if the canvas is having transparent background which makes it capture mouse events. You can set IsHitTestVisible to false to fix that but that will affect all the child items which might not be desirable. Setting the BackgroundColor to null does not help.


@whis.gg