Announcement

Collapse
No announcement yet.

Partner 728x90

Collapse

Referencing a ChartScale object outside of OnRender() to use <chartAnchor>.GetPoint()

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

    Referencing a ChartScale object outside of OnRender() to use <chartAnchor>.GetPoint()

    Is it acceptable to use <chartAnchor>.GetPoint() outside of OnRender(). To do this I'm acquiring the ChartScale oject from within OnRender, like this
    Code:
    protected override void OnRender(ChartControl _chartControl, ChartScale _chartScale)
    {
        base.OnRender(_chartControl, _chartScale);
        [B]chartScale [/B]= _chartScale;
    ​
    elsewhere unrelated to OnRender() I have this
    Code:
    private void GetPointsFromAnchor(bool _testSizeChanged)
    {
                rectStartPoint    = rect.StartAnchor.GetPoint( this.ChartControl, this.ChartPanel, [B]chartScale[/B], false );
    ​
    The reason I ask is, because I'm seeing random rendering errors, and wondering if that is the cause? The indicator still runs on the chart.

    - A direct X error has occurred while rendering the chart: HRESULT: [0x88990001], Module: [SharpDX.Direct2D1], ApiCode: [D2DERR_WRONG_STATE/WrongState], Message: The object was not in the correct state to process the method.
    - Chart rendering failed. There is likely a problem with a chart object's OnRender method. D2D error = 'HRESULT: [0x88990001], Module: [SharpDX.Direct2D1], ApiCode: [D2DERR_WRONG_STATE/WrongState], Message: The object was not in the correct state to process the method. '



    #2
    Hello zacharydw00,

    A Dispatcher.InvokeAsync() is needed to work with the ChartControl/ChartPanels/ChartScales.

    Chelsea B.NinjaTrader Customer Service

    Comment

    Latest Posts

    Collapse

    Topics Statistics Last Post
    Started by Geovanny Suaza, 02-11-2026, 06:32 PM
    0 responses
    607 views
    0 likes
    Last Post Geovanny Suaza  
    Started by Geovanny Suaza, 02-11-2026, 05:51 PM
    0 responses
    353 views
    1 like
    Last Post Geovanny Suaza  
    Started by Mindset, 02-09-2026, 11:44 AM
    0 responses
    105 views
    0 likes
    Last Post Mindset
    by Mindset
     
    Started by Geovanny Suaza, 02-02-2026, 12:30 PM
    0 responses
    560 views
    1 like
    Last Post Geovanny Suaza  
    Started by RFrosty, 01-28-2026, 06:49 PM
    0 responses
    561 views
    1 like
    Last Post RFrosty
    by RFrosty
     
    Working...
    X