• Hi All

    Please note that at the Chandoo.org Forums there is Zero Tolerance to Spam

    Post Spam and you Will Be Deleted as a User

    Hui...

  • When starting a new post, to receive a quicker and more targeted answer, Please include a sample file in the initial post.

Dynamic Chart VBA - Smoother Animation

chirayu

Well-Known Member
Hi Guys,

I've attached a sample file I made. It's a Dynamic Chart using VBA. However the animation isn't fluid.

Would it be possible to fix this? Could the code also be sped up?
 

Attachments

  • Dynamic Graph.xlsm
    21.8 KB · Views: 5
@Hui

Thanks. Looks awesome.

I have attached your file with some observations because I am trying to figure out how it does its stuff basically but can't seem to. Could you have a look & explain to me how its all working?
 

Attachments

  • Dynamic Graph.xlsm
    65.3 KB · Views: 14
The VBA Copies the Current values to a Named Formula Called Old
It copies the new Values into a named Formula called New
It then steps between the Old and new arrays in small steps of Steps Increment
At each step it updates the Chart Values named range with the incremental values

The Chart values are what the chart uses as Y values
 
Thanks @Hui

But had some more questions.

What does Easing do? Because I went through all the Named ranges in the file I had attached earlier & listed everything down & I couldn't figure it out.

Also since Switch_to_record is the same as Record_Index. Why don't we just use Record_Index? I didn't understand that but obviously your version is way more advanced than mine lol.

And another thing I didn't get when breaking down the formula for Easing was this bit (SIN(step/animation_steps)*2*PI())/(2*PI())

Specifically I mean the *2*PI()/2*PI() because if we remove that bit, it gives the same value as just SIN(step/animation_steps).
 
Easing allows smooth exit and entry to the end points of the movement
Turn it off and the speed is the same from start to end
 
@Hui

Thanks. I did some checking again & seems even though the end values are the same. If I try to shorten anything the graph won't give correct values. Guess theres some magic in your formulae :p

May I enquire as to where you learnt this veritable knowledge of VBA & how I may acquire the same
 
@Hui

Quick question. Lets say my Chart data has #N/A values. I noticed that using the Macro, it by default keeps value at 0 in chart for that month. Regardless of what is selected in the dropdown. Is there a way to handle this? Keep as #N/A instead of 0% & change to value when not #N/A?
 
Back
Top