Announcement

Collapse
No announcement yet.

Partner 728x90

Collapse

Internal NT ChartControl Inconsistencies

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

    Internal NT ChartControl Inconsistencies

    I realize this is deep in undocumented territory, but while doing some custom plots, I noticed some of the ChartControl vars do not stay consistent.

    If I have a chart up with lastBar at right edge, all of the following vars look ok:

    ChartControl.LastBarPainted <- index of last bar on chart (i.e. 7905)
    ChartControl.FirstBarPainted <- index of first bar on chart (i.e. 7826)
    ChartControl.BarsPainted <- number of bars painted (i.e. 80)

    Now if I scroll the data to the left one bar by hitting the right arrow key, I get something like the following:

    ChartControl.LastBarPainted <- 7906 This index does not exist yet!
    ChartControl.FirstBarPainted <- 7827 This is good.
    ChartControl.BarsPainted <- 80 Should be 79 now that a bar scrolled off.

    The only var that seems to be correct is FirstBarPainted. This continues if you continue to scroll.

    You can work around this, but I wanted to see if this is expected or a bug.

    This is with B7.

    #2
    As you stated this is not supported. Thus there is no expected behavior.

    Comment


      #3
      Thanks, thats what I expected, but wanted to make sure.

      That being the case, your example in code breaking changes doc of how to iterate thru bars is incorrect/misleading, as the LastBarPainted is not always accurate. You might want to take a look at that.

      Comment


        #4
        Thanks for your feedback.

        Comment


          #5
          Originally posted by aslane View Post
          I realize this is deep in undocumented territory, but while doing some custom plots, I noticed some of the ChartControl vars do not stay consistent.

          If I have a chart up with lastBar at right edge, all of the following vars look ok:

          ChartControl.LastBarPainted <- index of last bar on chart (i.e. 7905)
          ChartControl.FirstBarPainted <- index of first bar on chart (i.e. 7826)
          ChartControl.BarsPainted <- number of bars painted (i.e. 80)

          Now if I scroll the data to the left one bar by hitting the right arrow key, I get something like the following:

          ChartControl.LastBarPainted <- 7906 This index does not exist yet!
          ChartControl.FirstBarPainted <- 7827 This is good.
          ChartControl.BarsPainted <- 80 Should be 79 now that a bar scrolled off.

          The only var that seems to be correct is FirstBarPainted. This continues if you continue to scroll.

          You can work around this, but I wanted to see if this is expected or a bug.

          This is with B7.
          dont think that is wrong. you got to do is

          int lastbar = Math.Min(Bars.Count - 1, ChartControl.LastBarPainted);
          int barspainted = lastbar - ChartControl.FirstBarPainted;

          Comment


            #6
            Originally posted by aslane View Post
            Thanks, thats what I expected, but wanted to make sure.

            That being the case, your example in code breaking changes doc of how to iterate thru bars is incorrect/misleading, as the LastBarPainted is not always accurate. You might want to take a look at that.
            Please closely review the code breaking section of the upgrade document you should have received to understand that there is no reference to LastBarPainted.

            Comment

            Latest Posts

            Collapse

            Topics Statistics Last Post
            Started by Hwop38, 05-04-2026, 07:02 PM
            0 responses
            163 views
            0 likes
            Last Post Hwop38
            by Hwop38
             
            Started by CaptainJack, 04-24-2026, 11:07 PM
            0 responses
            313 views
            0 likes
            Last Post CaptainJack  
            Started by Mindset, 04-21-2026, 06:46 AM
            0 responses
            245 views
            0 likes
            Last Post Mindset
            by Mindset
             
            Started by M4ndoo, 04-20-2026, 05:21 PM
            0 responses
            350 views
            0 likes
            Last Post M4ndoo
            by M4ndoo
             
            Started by M4ndoo, 04-19-2026, 05:54 PM
            0 responses
            179 views
            0 likes
            Last Post M4ndoo
            by M4ndoo
             
            Working...
            X