Engineers-Excel.com

     
Engineering using Spreadsheets

Animation using Charts

Description















This tool is a proof-of-concept that shows how animated demonstrations can be made using Charts in Excel.

Download

.xls file (154 KB) .zip (64 KB)


Motivation

There are many instances where an animation can be an effective demonstration technique, but a typical set of software tools that an engineer has does not include software for animation. Microsoft Powerpoint is the usual presentation tool but its animation capabilities may not always be sufficient.

Excel charts can be used an animation tool to display data dynamically. This tool shows how X-Y and bar charts are animated using macros. The macro simply increments a counter, and Excel functionality creates the rest of the animation.

How to use

Macros must be enabled for this tool to work. Click on the "Animate" button on each sheet to run the animation.

The tool shows 3 examples of animation using charts:
1. Drawing a wreath, see the related 3 Wheel Spirograph tool
2. A process showing filling up of a tank by a pump
3. Decaying orbit of a planet, the data was obtained from the Coupled ODE Solver.

Video



How it works

The same macro runs the different animations, the macro simply increments a counter in cell B1. There is extra code to create the "rotation" effect for the first sheet. The data for the spirograph is created in memory using defined names, for the tank in cell A1 and the data for the planet comes from a table of values.

The animation for the tank also uses Conditional Formatting to show the pipes filled with water. The tank is like the "Thermometer Chart" described on this page, with the border lines removed.

The code is reproduced below.

Sub draw()
' Initialise
   Range("B14") = 0
   Range("B1") = 0
' Increment counter to 1000, add a small delay after each increment
    While Range("B1") < 1001
' Add Delay
        Range("B1") = Range("B1") + 1
        For c = 1 To 500000
        Next
' Allow updating
        DoEvents
    Wend
'Extra animation for spirograph
    If ActiveSheet.Name <> "Spirograph" Then Exit Sub
    'Increment counter at B14 with delay as before
    While Range("B14") < 10
        Range("B14") = Range("B14") + 0.05
        For c = 1 To 500000
        Next
        DoEvents
    Wend
End Sub