Announcement

Collapse

Looking for a User App or Add-On built by the NinjaTrader community?

Visit NinjaTrader EcoSystem and our free User App Share!

Have a question for the NinjaScript developer community? Open a new thread in our NinjaScript File Sharing Discussion Forum!
See more
See less

Partner 728x90

Collapse

Rendering speed of FrameworkElement when chart scale changes

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

    Rendering speed of FrameworkElement when chart scale changes

    I'm rendering an object to the chart using SharpDX and would like to convert it to a FrameworkElement so I can leverage its event methods. But I noticed that the FrameworkElement lags behind in rendering when the chart scale changes.

    To demonstrate this I have put together a test indicator. See attached. It renders a SharpDX FillRectangle (lime color), and a FrameworkElement (red). When you quickly change the Y scale of the chart you will see that the SharpDX FillRectangle follows along instantly. But the FrameWorkElement lags behind.

    So my question is, is there a way to render the FrameWorkElement as fast as SharpDX objects? Thanks.
    Attached Files

    #2
    Hi martyn73, thanks for your post.

    It would be recommended to keep everything in OnRender SharpDX related. WPF elements are meant to be added to the UserControlCollection once in State.Historical. What do you need to get done in OnRender that requires a grid? I can try to find a SharpDX example that will help.

    I look forward to hearing from you.
    Chris L.NinjaTrader Customer Service

    Comment


      #3
      Hi Chris, my objects mimic something similar to a Chart Trader flag. They require left and right click mouse interactions. So I was hoping to use the Framework Elements events for this. But certainly can get around that using SharpDX as well. However, I also want to be able to control the ZIndex (Canvas.SetZIndex) of these objects when they partly overlap. So when I hover my mouse on one I can bring it to the front. Any way this is possible with SharpDX?

      Comment


        #4
        Hello martyn73,

        When using SharpDX, the ZOrder for the indicator will be used. Everything is drawn on the same "layer" but we are able to control the order we draw things within OnRender. Logic can be used in OnRender to check the coordinates of your SharpDX drawings and where the mouse cursor is, and if the mouse is over any objects, you can change the order of drawing so that particular object is drawn last and on top.

        For detecting mouse coordinates, ChartPanel.MouseMove can be subscribed. Other mouse events can be subscribed from here as well.

        An example that adds context menu items can be found here - https://ninjatrader.com/support/foru...007#post702007

        Let us know if there is anything else we can do to help.
        JimNinjaTrader Customer Service

        Comment

        Latest Posts

        Collapse

        Topics Statistics Last Post
        Started by LawrenHom, Today, 10:45 PM
        0 responses
        3 views
        0 likes
        Last Post LawrenHom  
        Started by love2code2trade, Yesterday, 01:45 PM
        4 responses
        28 views
        0 likes
        Last Post love2code2trade  
        Started by funk10101, Today, 09:43 PM
        0 responses
        7 views
        0 likes
        Last Post funk10101  
        Started by pkefal, 04-11-2024, 07:39 AM
        11 responses
        37 views
        0 likes
        Last Post jeronymite  
        Started by bill2023, Yesterday, 08:51 AM
        8 responses
        44 views
        0 likes
        Last Post bill2023  
        Working...
        X