Bạn đang xem bản rút gọn của tài liệu. Xem và tải ngay bản đầy đủ của tài liệu tại đây (5.72 MB, 490 trang )
HiLoLines are shown in Figure 21-18. The HasHiLoLines property of the ChartGroup object can
be set to True to display HiLoLines. HiLoLines apply only to two-dimensional charts.
Figure 21-18. HiLoLines
21.8.4 SeriesCollection and Series Objects
The SeriesCollection property of a ChartGroup object returns the SeriesCollection collection of all
Series objects that lie in that chart group. We will discuss Series objects later in the chapter.
SeriesLines are shown in Figure 21-19. They apply only to stacked column or stacked bar chart
groups. The HasSeriesLines property can be set to True to display series lines for a chart group.
Figure 21-19. SeriesLines
21.9 The ChartTitle Object
A ChartTitle object represents a chart title. The ChartTitle object is shown in Figure 21-20.
Figure 21-20. The ChartTitle object
As with several of the other chart-related objects, the ChartTitle object has Border, Characters,
ChartFillFormat, Font, and Interior children that are used to format the corresponding portion of
the chart title. We have discussed these objects before, so we will not comment further on them
21.10 The DataTable Object
Figure 21-21 shows a data table. Data tables are represented by DataTable objects.
Figure 21-21. A data table
The Chart object has a property called HasDataTable. Setting this property to True displays a
data table, as in Figure 21-21. Indeed, the data table in Figure 21-21 was produced and given a
border with the following code:
ActiveChart.HasDataTable = True
ActiveChart.DataTable.HasBorderOutline = True
The DataTable object has a variety of self-explanatory properties, such as AutoScaleFont, Border,
Font, HasBorderHorizontal, HasBorderOutline, HasBorderVertical, and ShowLegendKey. (The
ShowLegendKey property is responsible for the small squares on the far left portion of the data
table in Figure 21-21.)
21.11 The Floor Object
The Floor object applies only to 3-D charts and represents the floor of the chart. For instance, the
ActiveChart.Floor.Interior.Pattern = xlPatternChecker
sets the floor of the active 3-D chart to a checkered pattern, as shown in Figure 21-22. The Floor
object has Border, ChartFillFormat, and Interior children.
Figure 21-22. The floor of a 3-D chart (checkered)
21.12 The Legend Object
Legend objects represent legends. The Legend object and its children are shown in Figure 21-23.
Figure 21-23. The Legend object
The Chart object has a Legend property that returns the Legend object for that chart. As expected,
the Legend object has Border, ChartFillFormat, Font, and Interior children that serve the same
purpose here as they do for the ChartTitle, AxisTitle, ChartArea, and other objects.
21.12.1 The LegendEntry Object
Figure 21-1 shows a chart legend with two legend entries. Legend entries are represented by
LegendEntry objects. The LegendEntry objects for a legend are kept in the LegendEntries
collection object for the Legend object. This collection is accessed using the LegendEntries
property of the Chart object.
Each legend entry has two parts: the text of the legend entry is the name of the series associated
with that entry and the entry key (also called an entry marker) is a small copy of the associated
series and its formatting.
Note that the text of a legend entry cannot be changed. However, the LegendEntry object does
have a Font property that can be used to change the font of the legend entry, as in:
ActiveChart.Legend.Font.Italic = True
In addition, LegendEntry objects can be deleted. However, after a legend entry has been deleted,
the only way to restore it is to remove and recreate the entire legend by setting the HasLegend
property for the chart first to False and then to True.
Also, no pattern formatting is allowed for legend entries, nor can a legend entry's position or size
Note finally that there is no direct way to return the series corresponding to a given legend entry.
21.12.2 The LegendKey Object
A legend key is represented by a LegendKey object. This object has Border, ChartFillFormat, and
It is very important to note that formatting the LegendKey object will also automatically format
the actual series that the legend entry represents. In other words, the series and its legend key
Thus, for instance, the following code formats the first data series and its legend key with a red
interior and a thick border: