Table of contents
TOC
折叠目录
展开目录

Chart.ChartWizard 方法 (PowerPoint)Chart.ChartWizard Method (PowerPoint)

office 365 dev account|上次更新日期: 2018/3/13
|
2 参与人员

修改给定图表的属性。可使用本方法快速设置图表的格式,而不必逐个设置所有属性。本方法是非交互式的,并且仅更改指定的属性。Modifies the properties of the given chart. You can use this method to quickly format a chart without setting all the individual properties. This method is noninteractive, and it changes only the specified properties.

语法Syntax

表达式expression.图表向导格式PlotByCategoryLabelsSeriesLabelsHasLegend标题CategoryTitleValueTitleExtraTitleChartWizard (Source, Gallery, Format, PlotBy, CategoryLabels, SeriesLabels, HasLegend, Title, CategoryTitle, ValueTitle, ExtraTitle)

表达式_一个表示图表对象的变量。_expression A variable that represents a Chart object.

参数Parameters

名称Name必需/可选Required/Optional数据类型Data TypeDescriptionDescription
SourceSource可选OptionalVariantVariant包含新图表的源数据的区域。The range that contains the source data for the new chart.如果省略此参数,则 Word 编辑活动图表或者活动工作表上选定的图表。If this argument is omitted, Word edits the active chart sheet or the selected chart on the active worksheet.
Gallery可选OptionalVariantVariant指定的图表类型的XlChartType常量之一。One of the XlChartType constants that specifies the chart type.
FormatFormat可选OptionalVariantVariant内置自动套用格式的选项编号。可为从 1 到 10 的数字,其取值依赖于库的类型。如果省略此参数,Word 将基于库的类型和数据源选择默认值。The option number for the built-in autoformats. Can be a number from 1 through 10, depending on the gallery type. If this argument is omitted, Word chooses a default value based on the gallery type and data source.
PlotByPlotBy可选OptionalVariantVariant指定每个数据系列的数据行或列中。Specifies whether the data for each series is in rows or columns.可以是下列的XlRowCol常量之一: xlRowsxlColumnsCan be one of the following XlRowCol constants: xlRows or xlColumns.
CategoryLabelsCategoryLabelsOptionalOptionalVariantVariant指定包含分类标签的源范围内的行数或列数的整数。合法值为从 0(零)至小于相应分类或系列的最大个数间的某一数字。An integer that specifies the number of rows or columns within the source range that contain category labels. Allowed values are from 0 (zero) through one less than the maximum number of the corresponding categories or series.
SeriesLabelsSeriesLabelsOptionalOptionalVariantVariant指定包含系列标签的源范围内的行数或列数的整数。合法值为从 0(零)至小于相应分类或系列的最大个数间的某一数字。An integer that specifies the number of rows or columns within the source range that contain series labels. Allowed values are from 0 (zero) through one less than the maximum number of the corresponding categories or series.
HasLegendHasLegend可选OptionalVariantVariant要包含一个图例。True to include a legend.
TitleTitle可选OptionalVariantVariant图表标题文字。The chart title text.
CategoryTitleCategoryTitle可选OptionalVariantVariant分类轴标题文字。The category axis title text.
ValueTitleValueTitle可选OptionalVariantVariant数值轴标题文字。The value axis title text.
ExtraTitleExtraTitle可选OptionalVariantVariant三维图表的系列轴标题,或二维图表的次数值轴标题。The series axis title for 3-D charts or the second value axis title for 2-D charts.


注解Remarks

如果省略 Source 参数,且所选内容不是活动文档中的图表,则此方法将失败并出现错误时。If the Source parameter is omitted, and the selection is not a chart on the active document, this method fails and an error occurs.

示例Example

请注意 尽管下面的代码应用到 word 文档中,您可以随时修改将其应用到 PowerPoint。Note Although the following code applies to Word, you can readily modify it to apply to PowerPoint.

下面的示例重新设置第一张图表的格式,将其改为折线图,添加图例,并添加分类轴标题和数值轴标题。The following example reformats the first chart as a line chart, adds a legend, and adds category and value axis titles.

With ActiveDocument.InlineShapes(1).Chart 
    .ChartWizard _ 
        Gallery:=xlLine, _ 
        HasLegend:=True, _ 
        CategoryTitle:="Year", _ 
        ValueTitle:="Sales" 
End With

另请参阅See also

概念Concepts

© 2018 Microsoft