Tải bản đầy đủ - 0 (trang)
Figure 21-7. The Chart Type dialog

Figure 21-7. The Chart Type dialog

Tải bản đầy đủ - 0trang

Cone



Cylinder



Doughnut

Line



Pie



Pyramid



xlBarStacked(58)

xlBarStacked100(59)

xlBubble(15)

xlBubble3DEffect(87)

xl3DColumn(-4100)

xl3DColumnClustered(54)

xl3DColumnStacked(55)

xl3DColumnStacked100(56)

xlColumnClustered(51)

xlColumnStacked(52)

xlColumnStacked100(53)

xlConeBarClustered(102)

xlConeBarStacked(103)

xlConeBarStacked100(104)

xlConeCol(105)

xlConeColClustered(99)

xlConeColStacked(100)

xlConeColStacked100(101)

xlCylinderBarClustered(95)

xlCylinderBarStacked(96)

xlCylinderBarStacked100(97)

xlCylinderCol(98)

xlCylinderColClustered(92)

xlCylinderColStacked(93)

xlCylinderColStacked100(94)

xlDoughnut(-4120)

xlDoughnutExploded(80)

xl3DLine(-4101)

xlLine(4)

xlLineMarkers(65)

xlLineMarkersStacked(66)

xlLineMarkersStacked100(67)

xlLineStacked(63)

xlLineStacked100(64)

xl3DPie(-4102)

xl3DPieExploded(70)

xlBarOfPie(71)

xlPie(5)

xlPieExploded(69)

xlPieOfPie(68)

xlPyramidBarClustered(109)

xlPyramidBarStacked(110)

xlPyramidBarStacked100(111)

xlPyramidCol(112)

xlPyramidColClustered(106)

xlPyramidColStacked(107)



AM

FL

Y



Column



TE



Bubble



Stacked Bar

100% Stacked Bar

Bubble

Bubble with 3D effects

3D Column

3D Clustered Column

3D Stacked Column

3D 100% Stacked Column

Clustered Column

Stacked Column

100% Stacked Column

Clustered Cone Bar

Stacked Cone Bar

100% Stacked Cone Bar

3D Cone Column

Clustered Cone Column

Stacked Cone Column

100% Stacked Cone Column

Clustered Cylinder Bar

Stacked Cylinder Bar

100% Stacked Cylinder Bar

3D Cylinder Column

Clustered Cylinder Column

Stacked Cylinder Column

100% Stacked Cylinder Column

Doughnut

Exploded Doughnut

3D Line

Line

Line with Markers

Stacked Line with Markers

100% Stacked Line with Markers

Stacked Line

100% Stacked Line

3D Pie

Exploded 3D Pie

Bar of Pie

Pie

Exploded Pie

Pie of Pie

Clustered Pyramid Bar

Stacked Pyramid Bar

100% Stacked Pyramid Bar

3D Pyramid Column

Clustered Pyramid Column

Stacked Pyramid Column



357 ®

Team-Fly



Radar



Stock

Quotes



100% Stacked Pyramid Column

Radar

Filled Radar

Radar with Data Markers



xlPyramidColStacked100(108)

xlRadar(-4151)

xlRadarFilled(82)

xlRadarMarkers(81)



High-Low-Close



xlStockHLC(88)



Open-High-Low-Close

Volume-High-Low-Close

Volume-Open-High-Low-Close

3D Surface

Surface

Surface (Top View)

Surface (Top View) wireframe)

3D Surface (wireframe)

XY (Scatter) Scatter

Scatter with Lines

Scatter with Lines and No Data Markers

Scatter with Smoothed Lines

Scatter with Smoothed Lines and No Data

Markers



xlStockOHLC(89)

xlStockVHLC(90)

xlStockVOHLC(91)

xlSurface(83)

xlSurfaceTopView(85)

xlSurfaceTopViewWireframe(86)

xlSurfaceWireframe(84)

xlXYScatter(-4169)

xlXYScatterLines(74)

xlXYScatterLinesNoMarkers(75)

xlXYScatterSmooth(72)

xlXYScatterSmoothNoMarkers(73)



In Example 21-3, at the end of the chapter, we present a macro that scrolls through the chart types

in Table 21-1, allowing you to determine which chart type is appropriate for a particular purpose.

Note that it is possible that the return value of the ChartType property may not be one of the

values in Table 21-1. For instance, the code:

MsgBox ActiveChart.ChartType



returns -4111 when applied to a chart with a particular user-defined chart type. This value

actually occurs only once in the Excel object model. It is part of the Constants enum and is

assigned the symbolic name xlCombination. (Since this seems not to be documented, I cannot

say that this is the only value of ChartType that is not in Table 21-1.)

Note that each individual data series can have a chart type; that is, the Series object also has a

ChartType property. In this way, if a chart has two data series, each series can have a different

chart type. For instance, one series can be plotted as a line graph and the other as a column graph.

(We will discuss Series objects later in the chapter.)

21.3.1.1 ApplyCustomType method

Contrary to its name, the ApplyCustomType method can apply either a standard or a custom chart

type to a chart. The syntax is:



ChartObject.ApplyCustomType(ChartType, TypeName)

The ChartType parameter is either a standard chart type constant from Table 21-1 or one of the

following XlChartGallery constants:

Enum XlChartGallery

xlBuiltIn = 21

xlUserDefined = 22



358



xlAnyGallery = 23

End Enum



(The term ChartGallery does not seem to appear in the Excel documentation. However, in the

Word object model, the term ListGallery refers to the objects that represent the three tabs in the

Bullets and Numbering dialog box. Extrapolating to Excel, we might surmise that the term

ChartGallery refers to the two tabs in the Chart Type dialog box in Figure 21-8.)

If ChartType is an XlChartGallery constant, then the optional TypeName parameter specifies

the name of the custom chart type.

For instance, the following code:

ActiveChart.ApplyCustomType _

ChartType:=xlBuiltIn, TypeName:="Blue Pie"



applies the built-in chart type called Blue Pie. This is equivalent to selecting Blue Pie in the Excel

dialog box shown in Figure 21-8.

Figure 21-8. Illustrating ApplyCustomType



As another example, the following code sets the chart type to a user-defined type named

DefaultXY:

ActiveChart.ApplyCustomType _

ChartType:=xlUserDefined, TypeName:="DefaultXY"



21.4 Children of the Chart Object



359



Figure 21-9 shows the children of the Chart object.

Figure 21-9. Children of the Chart object



An Excel chart has several components: axes, the chart area, a chart title, a data table, a floor (for a

3-D-chart), a plot area, and one or more data series (with data labels and data values). These

components are represented by the children of the Chart object, which we will now examine.



21.5 The Axes Collection

Figure 21-10 shows the portion of the Excel object model that relates to chart axes.

Figure 21-10. Axes-related objects



360



The Chart object has an Axes collection that contains an Axis object for each axis in the chart. The

Axes method returns either a single axis or the Axes collection for a chart. To return the Axes

collection for a chart, use the syntax:



ChartObject.Axes

To return a specific Axis object, use the syntax:



ChartObject.Axes(Type, AxisGroup)

Here the optional Type parameter specifies the axis to return. It can be one of the following

XlAxisType constants:

Enum XlAxisType

xlCategory = 1

xlValue = 2

xlSeriesAxis = 3

End Enum



Note that xlSeriesAxis is valid only for 3-D charts.

The optional AxisGroup parameter specifies the axis group. It can be one of the following

XlAxisGroup constants:

Enum XlAxisGroup

xlPrimary = 1

xlSecondary = 2

End Enum



' The default



A secondary axis is a second vertical or horizontal axis upon which a second value series (vertical

case) or category series (horizontal case) is plotted (see Figure 21-1). If this argument is omitted,

the primary group is used. Note that 3-D charts have only one axis group.



361



Tài liệu bạn tìm kiếm đã sẵn sàng tải về

Figure 21-7. The Chart Type dialog

Tải bản đầy đủ ngay(0 tr)

×