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 Mindset, 04-21-2026, 06:46 AM
    0 responses
    63 views
    0 likes
    Last Post Mindset
    by Mindset
     
    Started by M4ndoo, 04-20-2026, 05:21 PM
    0 responses
    92 views
    0 likes
    Last Post M4ndoo
    by M4ndoo
     
    Started by M4ndoo, 04-19-2026, 05:54 PM
    0 responses
    48 views
    0 likes
    Last Post M4ndoo
    by M4ndoo
     
    Started by cmoran13, 04-16-2026, 01:02 PM
    0 responses
    106 views
    0 likes
    Last Post cmoran13  
    Started by PaulMohn, 04-10-2026, 11:11 AM
    0 responses
    63 views
    0 likes
    Last Post PaulMohn  
    Working...
    X