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 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