Announcement

Collapse
No announcement yet.

Partner 728x90

Collapse

OnRender method draws rectangles upsidedown

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

    OnRender method draws rectangles upsidedown

    I wish to use SharpDX to draw volume bars that overlap the main chart, while controlling its opacity dynamically. This is what I've attempted so far:
    Code:
    ...
               
                for (int idx = ChartBars.FromIndex; idx <= ChartBars.ToIndex; idx++)
                {
                    float x = chartControl.GetXByBarIndex(ChartBars, idx);
                    long v2 = ChartBars.Bars.GetVolume(idx);
                    float v2y = chartScale.GetYByValue(v2);
                    rect.X = x - barWidth * 0.5f + 0.5f;
                    rect.Y = 0;
                    rect.Width = barWidth - 1;
                    rect.Height = v2;
    
                    
                    RenderTarget.FillRectangle(rect, cbrush);
    				
                }cbrush.Dispose();
            }
    ...
    I don't know what I'm doing wrong, but the rectangle are drawn upside down; also the left-hand side y-axis volume units do not appear to be correct... What can I do to incorporate OnMarketData information on a tick by tick basis into my OnRender method call?
    Last edited by bkinvent; 01-22-2016, 01:30 AM.

    #2
    Hello,

    Thank you for the question.

    I checked the sample but was noticed there are a few missing variables here, I wanted to see if you could post a full example with your variables and how you are calculating the barWidth variable.

    I would like to first see what you are before trying to address your question.

    I look forward to being of further assistance.

    Comment

    Latest Posts

    Collapse

    Topics Statistics Last Post
    Started by Geovanny Suaza, 02-11-2026, 06:32 PM
    0 responses
    673 views
    0 likes
    Last Post Geovanny Suaza  
    Started by Geovanny Suaza, 02-11-2026, 05:51 PM
    0 responses
    379 views
    1 like
    Last Post Geovanny Suaza  
    Started by Mindset, 02-09-2026, 11:44 AM
    0 responses
    111 views
    0 likes
    Last Post Mindset
    by Mindset
     
    Started by Geovanny Suaza, 02-02-2026, 12:30 PM
    0 responses
    577 views
    1 like
    Last Post Geovanny Suaza  
    Started by RFrosty, 01-28-2026, 06:49 PM
    0 responses
    582 views
    1 like
    Last Post RFrosty
    by RFrosty
     
    Working...
    X