+ Reply to Thread
Results 1 to 3 of 3

Chart Updates

  1. #1
    Registered User
    Join Date
    01-17-2019
    Location
    Scotland
    MS-Off Ver
    365
    Posts
    65

    Question Chart Updates

    Hi All,

    I cant post the whole code due to size and the data but basically, I am having an issue updating a chart. I want, if possible, for the chart to update each iteration of a loop (I'm looping over columns and rows). I know that the loops are running and that the data is updating (I have the loop counter and data temporarily referenced to individual debug cells) but the chart only updates right at the end.

    I assumed that the loops were running too fast so I added DoEvents (and even screen updating) as below but still no updates. The Call Delay is an existing function to slow loops down but that doesn't help whether in front or behind the chartObj refresh.

    Next i ' End of row loop

    Call Delay

    Application.ScreenUpdating = True
    chartObj.Chart.Refresh
    DoEvents


    Am i missing a way to 'force' an update as data changes?


    Any thoughts appreciated thanks

    Next j ' End of column loop

  2. #2
    Forum Guru Andy Pope's Avatar
    Join Date
    05-10-2004
    Location
    Essex, UK
    MS-Off Ver
    O365
    Posts
    20,436

    Re: Chart Updates

    Post example file.

    Or at least explain what is changing in the loop to affect the chart.

    You could try adding a couple more DoEvents if one is not doing the trick.
    Cheers
    Andy
    www.andypope.info

  3. #3
    Registered User
    Join Date
    01-17-2019
    Location
    Scotland
    MS-Off Ver
    365
    Posts
    65

    Re: Chart Updates

    The nested loops are simply taking a 2D block of data, iterating columns then running a check of data down a series of rows. Basically, each cell in each row is checked against a corresponding row value to check higher/lower causing icons (named per a corresponding row) to be updated on a diagram. To reduce the overhead I was intending to update the chart on column shift rather than on the row shift (one action per loop rather than dozens in the row loop).


    I did actually get the update to work by moving it back into the row loop (the individual chart bars now update in real-time) but it doubles run-time.

    I then spammed DoEvents to see if they were being skipped (as you noted):

    " Next i ' End of row loop

    chartObj.Chart.Refresh
    DoEvents
    DoEvents
    DoEvents

    Call Delay

    Next j ' End of column loop "

    Trial and error suggests, for my application at least, it takes 3 x DoEvents before Excel takes the hint (1 is ignored and 2 only updates on about half of the iterations).

    it really looks like Excel just doesn't update the chart (even with the DoEvents) on a loop that takes a fraction of a second.

    I will leave the question open for a couple of days to see if anyone has any thoughts on a more elegant solution

+ Reply to Thread

Thread Information

Users Browsing this Thread

There are currently 1 users browsing this thread. (0 members and 1 guests)

Similar Threads

  1. A Chart Legend that automatically updates itself?
    By SChalaev in forum Excel General
    Replies: 2
    Last Post: 02-06-2015, 12:49 AM
  2. I want to create a chart which only updates when
    By Wizards in forum Excel Charting & Pivots
    Replies: 1
    Last Post: 08-05-2014, 06:21 AM
  3. I want to create a chart which only updates when
    By Wizards in forum Excel Charting & Pivots
    Replies: 1
    Last Post: 08-05-2014, 06:20 AM
  4. Chart updates itself based on another cell's value
    By jberkman in forum Excel Charting & Pivots
    Replies: 0
    Last Post: 03-11-2014, 11:15 AM
  5. Automated Chart Updates.
    By itsnick in forum Excel Programming / VBA / Macros
    Replies: 2
    Last Post: 12-20-2011, 06:06 PM
  6. Bar Chart Updates From Left To Right
    By Philb1 in forum Excel Charting & Pivots
    Replies: 1
    Last Post: 09-14-2011, 06:44 AM
  7. Dynamic Chart updates
    By [email protected] in forum Excel Programming / VBA / Macros
    Replies: 0
    Last Post: 10-07-2005, 02:05 PM

Bookmarks

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts

Search Engine Friendly URLs by vBSEO 3.6.0 RC 1