The Anatomy of a Chart

Now that you have made VBA plot a chart for you, we can look at the ways in which you can use code to manipulate the chart. The first step in the process is to get familiar with the VBA equivalents of the various elements of a chart. Then you will learn to apply the available methods to and modify the properties of these elements to achieve your objectives.

Some elements (for example, chart area, plot area, chart title, legend) are common to all chart types, whereas others (such as the start angle of a pie chart or the perspective settings of a 3D chart) apply to specific types only. Line, scatter, and area charts have two axes, a radar chart has one axis for each category, and pie and doughnut charts have none.

As you progress, you will find that the VBA names of all objects, properties, and methods are logically devised and very similar to the terms you normally use to refer to them. For example, the VBA name for Chart Area is ChartArea and the Plot Area is referred to as PlotArea. Notice that the only difference is that there are no spaces in each name. This is a basic feature of VBA—no VBA entity name can contain a space.

0 0

Post a comment