|| GMEX Copter
|GMEXCEL Main||DzikoSoft Home||Useful Links|
Introduction to Animated Charts
Excel charts are extreme useful in reporting and data analysis, but they may be used in many other unusual ways. Excel games rely mostly on shapes and worksheet cells, but static charts very also utilized, like in Nicolas Sylvain’s Canons when a chart was used to present the trajectory of a missile.
Charts can be animated – when different time series are presented at different time points. Power Point allows to easily program such animations, but with the help of a little VBA coding it can also be produced in Excel. Take for example the Bubble Chart:
It would be interesting to make bubbles rotate around the center of the chart or move in any other way. The position of each bubble is given by the value of two cell. The idea for chart animations is thus extremely simple - update the value of the cells and refresh the chart.
Charts, like shapes, do not refresh automatically while macro is running. You need DoEvents command or equivalent to update the chart. In fact, this is very convenient, as you could first update entire series, and then chart is refreshed only once for one frame of animation. Make should that the chart axes have fixed minimum and maximum values to avoid re-scaling the chart during consecutive frames.
The file below include two simple chart animations, one of which are dancing bubbles in bubble chart:
Animating bubbles in bubble chart could easily be replaced with simple shape animation of several oval shapes. But some charts create unique possibilities. For example, the area chart could be used to produce the effect of cave walls (similar to that of my GMEX Copter) very useful for horizontal scrolling shooters or similar games. Using custom filling or texture could produce a very nice visual effects:
The area chart cave scrolling is also included in the file above. If you ding into the VBA project, you will see that the code is extremely simple and comprises of literally several lines. One could try to replicate this animation with for example VBA generated Freeforms but the code would probably be ten times more complicated.
This is the biggest advantage of chart animation - it is extremely simple, because all you need is to adjust the series and refresh the chart, the animation effect is based on Excel build-in chart functionality. Of course, you could also manipulate the chart objects directly to make the animation even more refined.
With Excel 2007 new eye-catching charts the animation would look even cooler. Excel charts are definitely the area that needs further exploration by VBA game developers.
|read previous tips||read next tips|