Announcement

Collapse
No announcement yet.

Partner 728x90

Collapse

Custom Render - Example

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

    #16
    I feel I am trying to do something similar to this conversation, so I'm posting this here.

    I'm wanting to use the appearance of a Plot[], to use as the basis when formatting a RenderTarget.DrawLine() line.

    Something like this:

    PHP Code:
    RenderTarget.DrawLine(p0.ToVector2(), p1.ToVector2(), Plots[0].BrushDXPlots[0].WidthPlots[0].StrokeStyle); 
    But, that doesn't give the same output as the plot (close, but not if dashed, dotted, etc). As mentioned above, the StrokeStyle object may be a little simplier than the RenderTarget is needing.

    Is there a way around this? Can I get a DashStyleHelper object from the Plot, create a StrokeStyle object, then pass that to DrawLine()?

    Like this (but actually pulling information from Plot[])

    PHP Code:
    StrokeStyle strokeStyle = new Stroke(Brushes.GrayDashStyleHelper.Dot5f).StrokeStyle;
    RenderTarget.DrawLine(p0.ToVector2(), p1.ToVector2(), Plots[0].BrushDXPlots[0].WidthstrokeStyle); 

    Any help is greatly appreciated!
    Last edited by neoikon; 09-18-2016, 09:37 AM.

    Comment


      #17
      Hello neoikon,

      As these are different types of objects, the properties are not the same type of properties.

      I am not aware of a way to convert these, however, I am checking with our development to see if they know of a way.

      I appreciate your patience.
      Chelsea B.NinjaTrader Customer Service

      Comment


        #18
        Originally posted by NinjaTrader_ChelseaB View Post
        I am not aware of a way to convert these, however, I am checking with our development to see if they know of a way.
        Thanks! To be clear, I'm not talking about converting, but determining enough formatting information from the Plot() object to create required formatting objects to make a RenderTarget.DrawLine() look the same as the Plot.

        Comment


          #19
          Hello neoikon,

          Have I must understood your inquiry.

          Are you not trying to use the DashStyleHelper from a plot as the SharpDX.Direct2D1.DashStyle for a rendered object?

          If so, I was referring to converting the DashStyleHelper to SharpDX.Direct2D1.DashStyle.

          If this is what you are looking for you can use an if statement and choose the correct dashstyle, but we have not found a way to convert one type to the other type.

          SharpDX.Direct2D1.DashStyle useDashStyle;

          if(Plots[0].DashStyleHelper.ToString() == "Solid")
          {
          useDashStyle = SharpDX.Direct2D1.DashStyle.Solid;
          }


          If you are not wanting to use the DashStyleHelper from a plot as the DashStyle for SharpDX object, can you clarify what you are trying to do?
          Chelsea B.NinjaTrader Customer Service

          Comment


            #20
            As I mentioned, "determine enough formatting information from the Plot() object to create required formatting objects to make a RenderTarget.DrawLine() look the same as the Plot."

            RenderTarget.DrawLine() accepts a StrokeStyle (not a DashStyle nor a PlotStyle).

            DashStyleHelper is not enough, since it could also have a PlotStyle of "TriangleUp" or "Cross" or some other appearance.

            Comment


              #21
              Hello neoikon,

              What further information are you needing to be able to create the StrokeStyle or object?

              The plots also have a StrokeStyle object.
              Plots[0].StrokeStyle.DashStyle
              Plots[0].StrokeStyle.DashOffset

              Using the if statement to select the DashStyle for the new StrokeStyle as well as the Plot[0].Width and the Plots[0].Brush or BrushDX, you should have the dash style the width and the color..
              Chelsea B.NinjaTrader Customer Service

              Comment

              Latest Posts

              Collapse

              Topics Statistics Last Post
              Started by bmartz, Today, 09:30 AM
              2 responses
              11 views
              0 likes
              Last Post bltdavid  
              Started by f.saeidi, Today, 11:02 AM
              1 response
              3 views
              0 likes
              Last Post NinjaTrader_BrandonH  
              Started by geotrades1, Today, 10:02 AM
              4 responses
              12 views
              0 likes
              Last Post geotrades1  
              Started by rajendrasubedi2023, Today, 09:50 AM
              3 responses
              16 views
              0 likes
              Last Post NinjaTrader_BrandonH  
              Started by lorem, Today, 09:18 AM
              2 responses
              11 views
              0 likes
              Last Post NinjaTrader_ChelseaB  
              Working...
              X