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 each ChartPanel independently

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

    Rendering each ChartPanel independently

    I have a main indicator that collects data. Then I have several instances of another secondary indicator that renders a very complex and heavy drawing from the main indicator data. In total in the chartcontrol there is a main indicator and seven or eight instances of the secondary indicator (each with its own rendering according to its parameters).
    Some instances of the secondary indicator respond to the MouseMove event of the main indicator and must update their rendering. But other instances are fixed and should not be updated with the movement of the mouse on the main panel, thus saving me its rendering. My question is: is it possible to isolate the rendering of the ChartPanel from each of the secondary indicators ?
    The ForceRefresh () method does not work for me because it affects the entire chartcontrol and not just the Panel of the indicator that calls the method.
    I would greatly appreciate any hints or help.
    Last edited by cls71; 11-17-2019, 01:33 PM.

    #2
    Hello cls71,

    From my understanding, the ChartControl is one RenderTarget and the panels are clipped to their parameters.

    Add multiple panels and use this test indicator to get the price and time on the other panel to see what I mean.


    Each indicator really only references one panel and not multiple panels. For multiple panels it would be recommended to have multiple instances of the indicator added to each panel.

    If there are mouse events, have one indicator instance per panel. On click, ensure its within the bounds of the indicator panel. Have fewer event handlers and fewer objects created per instance if possible.


    Chelsea B.NinjaTrader Customer Service

    Comment


      #3
      Thanks ChelseaB,

      but my problem is with isolating the renderings of each ChartPanel. ChartControl.InvalidateVisual() or ForceRefresh() render all ChartPanels.
      I am searching something like ChartPanel.InvalidateVisual and only render (code inside the OnRender) for that particular ChartPanel.
      But ChartPanel.InvalidateVisual() does not work for that purpose.

      Perhaps, one solution could be to add a Canvas (overwriting its OnRender() method with custom code) to the UserControlCollection of the indicator and call the Canvas.InvalidateVisual() when you need to render the ChartPanel of a specific instance of the indicator. (I tried calling the indicator's OnRender() method directly, but it doesn't work.). I will investigate it.

      I'm sorry not to explain myself better

      Comment


        #4
        Hello cls71,

        Unfortunately, the chart does not work this way. It is not possible to invalidate only some parts of a render target. Either the whole render target is invalidated or it is not.

        I think you are requesting for charts to have multiple rendering targets for each panel. This would use more resources and require more complex rendering code in NinjaScripts but would allow only one of the rendering targets to be invalidated.

        Is this what you are asking?
        Chelsea B.NinjaTrader Customer Service

        Comment


          #5
          Hello ChelseaB,

          yes, that is.

          The only thing I think can achieve something similar is to add a Canvas in the UserControlCollection of the indicator, and call the Canvas.InvalidateVisual for only the indicator that requires it.

          Thanks

          Comment


            #6
            Hello cls71,

            This request is being tracked with ID# SFT-4388..

            As with all feature requests, interest is tracked before implementation is considered, so we cannot offer an ETA or promise of fulfillment. If implemented, it will be noted in the Release Notes page of the Help Guide.

            Release Notes — https://ninjatrader.com/support/help...ease_notes.htm
            Chelsea B.NinjaTrader Customer Service

            Comment

            Latest Posts

            Collapse

            Topics Statistics Last Post
            Started by Jon17, Today, 04:33 PM
            0 responses
            1 view
            0 likes
            Last Post Jon17
            by Jon17
             
            Started by Javierw.ok, Today, 04:12 PM
            0 responses
            6 views
            0 likes
            Last Post Javierw.ok  
            Started by timmbbo, Today, 08:59 AM
            2 responses
            10 views
            0 likes
            Last Post bltdavid  
            Started by alifarahani, Today, 09:40 AM
            6 responses
            41 views
            0 likes
            Last Post alifarahani  
            Started by Waxavi, Today, 02:10 AM
            1 response
            21 views
            0 likes
            Last Post NinjaTrader_LuisH  
            Working...
            X