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 CarlTrading, 03-31-2026, 09:41 PM
    1 response
    39 views
    0 likes
    Last Post NinjaTrader_ChelseaB  
    Started by CarlTrading, 04-01-2026, 02:41 AM
    0 responses
    18 views
    0 likes
    Last Post CarlTrading  
    Started by CaptainJack, 03-31-2026, 11:44 PM
    0 responses
    25 views
    1 like
    Last Post CaptainJack  
    Started by CarlTrading, 03-30-2026, 11:51 AM
    0 responses
    41 views
    0 likes
    Last Post CarlTrading  
    Started by CarlTrading, 03-30-2026, 11:48 AM
    0 responses
    34 views
    0 likes
    Last Post CarlTrading  
    Working...
    X