Announcement

Collapse
No announcement yet.

Partner 728x90

Collapse

OnRender vs Draw.xx methods clarification

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

    OnRender vs Draw.xx methods clarification

    Hello, i am seeking some clarification regarding the N8 OnRender for drawing on the chart area. I have migrated some N7 code using OnRender successfully with simple drawing but wanted to check on the other Draw.xx methods available.

    The below represents what is available with RenderTarget 4 methods

    DrawLine() Draws a line between two points

    DrawRectangle()
    Draws a rectangle between two points

    FillRectangle()
    Draws a rectangle between two points

    OnRenderTargetChanged()
    Called whenever a Chart's RenderTarget is created or destroyed





    the question is .... where previously Plot override was used and I used some organised classes to draw from referencing the graphics object :



    can we intermix RenderTarget draw methods with the Draw.xxx eg Draw.Line Draw.Text methods .... and invoke a function/class method from the OnRender ... which manages the other aspects eg. OnCalculateMinMax.


    I just want some clarification on this and recommendations/pointers for this ..... for more complex drawing needs that requires methods other than above


    ie in onRender can i just use the Draw. methods ... the help description describes about copies being made .... and perhaps this is reserved for more complex drawing where changes and mouse clicks need to be tracked?


    OR is it essential to at least use some RenderTarget calls with SharDX brush definitions?


    I think this would help clarify in others minds as there is fairly limited documentation on this ... and whilst i have been able to create some OnRender overrides for simple conversions with only a few draw calls required before i embark on my other conversion wanted to check in on this.

    any clarification on the above let me know
    but it is more of a distinction between the Draw methods whilst i understand OnRender gives ability to control and reference XY and chartcontrol methods for drawing in the general chart region.


    thanks

    #2
    Hello,

    You should find no problem working with both NinjaScript drawing methods and SharpDX drawing methods within OnRender, and you can access any of the NinjaScript drawing objects' properties from within OnRender, as well.

    The big distinction here is that SharpDX drawing requires a RenderTarget, and OnRender provides a ready-made RenderTarget for you. Thus, you will want to do your SharpDX work within that event. NinjaScript drawing methods (Draw.X) have no such requirement, and are already connected to logic related to slot indexes and the x- and y-axis, so you can call them in a greater scope.
    Dave I.NinjaTrader Product Management

    Comment

    Latest Posts

    Collapse

    Topics Statistics Last Post
    Started by judysamnt7, 03-13-2023, 09:11 AM
    4 responses
    59 views
    0 likes
    Last Post DynamicTest  
    Started by ScottWalsh, Today, 06:52 PM
    4 responses
    36 views
    0 likes
    Last Post ScottWalsh  
    Started by olisav57, Today, 07:39 PM
    0 responses
    7 views
    0 likes
    Last Post olisav57  
    Started by trilliantrader, Today, 03:01 PM
    2 responses
    21 views
    0 likes
    Last Post helpwanted  
    Started by cre8able, Today, 07:24 PM
    0 responses
    10 views
    0 likes
    Last Post cre8able  
    Working...
    X