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 CaptainJack, 05-29-2026, 05:09 AM
    0 responses
    224 views
    0 likes
    Last Post CaptainJack  
    Started by CaptainJack, 05-29-2026, 12:02 AM
    0 responses
    142 views
    0 likes
    Last Post CaptainJack  
    Started by charlesugo_1, 05-26-2026, 05:03 PM
    0 responses
    157 views
    1 like
    Last Post charlesugo_1  
    Started by DannyP96, 05-18-2026, 02:38 PM
    1 response
    237 views
    0 likes
    Last Post NinjaTrader_ChelseaB  
    Started by CarlTrading, 05-11-2026, 05:56 AM
    0 responses
    196 views
    0 likes
    Last Post CarlTrading  
    Working...
    X