• If this is your first visit, you will have to register before you can post. To view messages, please scroll below and select the forum that you would like to visits. Questions? Be sure to check out the Forum FAQ.

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 Rmos22, Today, 02:20 PM
              0 responses
              7 views
              0 likes
              Last Post Rmos22
              by Rmos22
               
              Started by sawtooth500, Today, 12:59 PM
              1 response
              3 views
              0 likes
              Last Post NinjaTrader_Spencer  
              Started by Steve L, Yesterday, 09:36 PM
              1 response
              19 views
              0 likes
              Last Post NinjaTrader_Kate  
              Started by MichaelAlexander, 04-25-2017, 03:28 AM
              9 responses
              1,170 views
              0 likes
              Last Post dani neira  
              Started by uday12, Today, 11:34 AM
              2 responses
              9 views
              0 likes
              Last Post uday12
              by uday12
               
              Working...
              X