Announcement

Collapse
No announcement yet.

Partner 728x90

Collapse

I can't see the rendered text in the subpanel.

Collapse
X
 
  • Filter
  • Time
  • Show
Clear All
new posts

    I can't see the rendered text in the subpanel.

    Hello, everyone.
    I made something but it doesn't work well.

    Here is my code.
    Code:
    ...
    protected override void OnRender(ChartControl chartControl, ChartScale chartScale)
            {
                base.OnRender(chartControl, chartScale);
                
                if (!IsInHitTest)
                {
                    SharpDX.Direct2D1.Brush color;        
                    color = Brushes.White.ToDxBrush(RenderTarget);
        
                    NinjaTrader.Gui.Tools.SimpleFont simpleFont = new NinjaTrader.Gui.Tools.SimpleFont("Arial", 16);
                    SharpDX.DirectWrite.TextFormat textFormat = simpleFont.ToDirectWriteTextFormat();
                    
                    string msg = trendStr;
                    
                    SharpDX.DirectWrite.TextLayout textLayout = new SharpDX.DirectWrite.TextLayout(NinjaTrader.Core.Globals.DirectWriteFactory, msg, textFormat, 400, textFormat.FontSize);
                    SharpDX.Vector2 lowerTextPoint = new SharpDX.Vector2(ChartPanel.W-textLayout.Metrics.Width, ChartPanel.H-textLayout.Metrics.Height);
                    RenderTarget.DrawTextLayout(lowerTextPoint, textLayout, color, SharpDX.Direct2D1.DrawTextOptions.NoSnap);
        
                    color.Dispose();
                    textFormat.Dispose();
                    textLayout.Dispose();
                }
            }​
    ...
    The problem is that when the IsOverlay is true, the text is displayed, but when the IsOverlay is false, the text is not displayed.
    Do I need to make any specific settings for these two cases?
    If not, what are some solutions?
    Thanks.​
    Attached Files

    #2
    Hello truepenny,

    Add ChartPanel.Y to the Vector2 y parameter to account for the upper panel.
    Chelsea B.NinjaTrader Customer Service

    Comment

    Latest Posts

    Collapse

    Topics Statistics Last Post
    Started by CarlTrading, 03-31-2026, 09:41 PM
    1 response
    127 views
    1 like
    Last Post NinjaTrader_ChelseaB  
    Started by CarlTrading, 04-01-2026, 02:41 AM
    0 responses
    73 views
    1 like
    Last Post CarlTrading  
    Started by CaptainJack, 03-31-2026, 11:44 PM
    0 responses
    115 views
    2 likes
    Last Post CaptainJack  
    Started by CarlTrading, 03-30-2026, 11:51 AM
    0 responses
    109 views
    1 like
    Last Post CarlTrading  
    Started by CarlTrading, 03-30-2026, 11:48 AM
    0 responses
    88 views
    0 likes
    Last Post CarlTrading  
    Working...
    X