Announcement

Collapse
No announcement yet.

Partner 728x90

Collapse

Draw.Rectangle Area && Opacity

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

    Draw.Rectangle Area && Opacity

    Hey NT,

    I believe I found a bug for y'all.

    On Draw.Rectangle it allows you to set the color for the area and opacity level, however it only draws the line and not the area at all. See code and picture.

    Code:
    Draw.Rectangle(this,"Line"+CurrentBar.ToString()+i,true,0,(MAX(High,Period)[0]) - ((i)*TickSize*BoxSize),1,(MAX(High,Period)[0]) - ((i+1)*TickSize*BoxSize),Brushes.Gray,Brushes.DimGray,5);
    This code should be drawing the area of the rectangle, but only draws the outline.

    Cheers,

    Sody
    Attached Files

    #2
    Draw Square

    Also, a suggestion!

    Draw.Square is awesome for Point and Figure, but there is no opacity parameter.. I would suggest adding one, us power users might really like it.

    Sody
    Attached Files

    Comment


      #3
      This may work,

      Create a separate Brush:
      Brush brushBid=new SolidColorBrush(System.Windows.Media.Colors.Red);
      brushBid.Opacity=0.3;

      This works for me with some of the SharpDX stuff, don't see why the Brush wouldn't work for the lines as well.

      Comment


        #4
        Originally posted by NJA_MC View Post
        This may work,

        Create a separate Brush:
        Brush brushBid=new SolidColorBrush(System.Windows.Media.Colors.Red);
        brushBid.Opacity=0.3;

        This works for me with some of the SharpDX stuff, don't see why the Brush wouldn't work for the lines as well.
        Getting closer maybe...

        Failed to call OnRender() for chart object 'Square': The calling thread cannot access this object because a different thread owns it'
        Code:
        Brush brushBid=new SolidColorBrush(System.Windows.Media.Colors.DimGray);
        			brushBid.Opacity=0.3;
        Code:
        Draw.Square(this,"tag"+CurrentBar.ToString()+i,true,0,(MAX(High,Period)[0]) - ((i)*TickSize*BoxSize),brushBid);
        Might need a new thread? Dispatch.BeginInvoke?

        Sody
        Last edited by SodyTexas; 05-12-2015, 12:52 PM.

        Comment


          #5
          I am not sure you can access the Draw functions in the OnRender... You will likely need to use the SharpDX functions.

          Here is a FillRectangle example:
          RenderTarget.FillRectangle(new RectangleF(chartControl.CanvasRight, chartScale.GetYByValue(key.Key) - (height / 2), (int)-(key.Value * barLengthScale), height), brushAsk.ToDxBrush(RenderTarget));
          Last edited by NJA_MC; 05-12-2015, 01:29 PM.

          Comment


            #6
            Originally posted by NJA_MC View Post
            I am not sure you can access the Draw functions in the OnRender... You will likely need to use the SharpDX functions.

            Here is a FillRectangle example:
            RenderTarget.FillRectangle(new RectangleF(chartControl.CanvasRight, chartScale.GetYByValue(key.Key) - (height / 2), (int)-(key.Value * barLengthScale), height), brushAsk.ToDxBrush(RenderTarget));
            Thanks, SharpDX functions worked..
            Attached Files

            Comment


              #7
              I'd recommend using SharpDX stuff directly rather than the draw methods for such tasks. For power users such as yourself, you can always create your own draw object, and in fact, implement your own signatures to be called from other indicators, etc...
              MatthewNinjaTrader Product Management

              Comment

              Latest Posts

              Collapse

              Topics Statistics Last Post
              Started by rhyminkevin, Today, 04:58 PM
              4 responses
              52 views
              0 likes
              Last Post dp8282
              by dp8282
               
              Started by iceman2018, Today, 05:07 PM
              0 responses
              5 views
              0 likes
              Last Post iceman2018  
              Started by lightsun47, Today, 03:51 PM
              0 responses
              7 views
              0 likes
              Last Post lightsun47  
              Started by 00nevest, Today, 02:27 PM
              1 response
              14 views
              0 likes
              Last Post 00nevest  
              Started by futtrader, 04-21-2024, 01:50 AM
              4 responses
              50 views
              0 likes
              Last Post futtrader  
              Working...
              X