Table of contents

Chart.ChartWizard 方法 (项目)Chart.ChartWizard Method (Project)

office 365 dev account|上次更新日期: 2017/9/25
1 参与者

修改的属性和格式的图表。Modifies the properties and formatting of a chart.


表达式图表向导(varSource,varGallery,varFormat,varPlotBy,varCategoryLabels,varSeriesLabels,varHasLegend,varTitle,varCategoryTitle,varValueTitle,__varExtraTitle)expression. ChartWizard(varSource,varGallery,varFormat,varPlotBy,varCategoryLabels,varSeriesLabels,varHasLegend,varTitle,varCategoryTitle,varValueTitle,varExtraTitle)

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


名称Name必需/可选Required/Optional数据类型Data type说明Description
varSourcevarSource可选OptionalVariantVariant新图表的源数据。如果忽略_varSource_参数,则项目编辑活动报告或所选的图表上的活动的报告。The source data for a new chart. If the varSource argument is omitted, Project edits the active report or the selected chart on the active report.
varGalleryvarGallery可选OptionalVariantVariant指定的图表类型Office.XlChartType枚举的常量之一。One of the constants of the Office.XlChartType enumeration, which specifies the chart type.
varFormatvarFormat可选OptionalVariantVariant内置自动套用格式选项编号。可以是介于 1 到 10,具体取决于库的类型。如果忽略_varFormat_参数,项目选择上,基于库类型和数据源的默认值。The option number for the built-in autoformats. Can be a number from 1 through 10, depending on the gallery type. If the varFormat argument is omitted, Project chooses a default value based on the gallery type and data source.
varPlotByvarPlotBy可选OptionalVariantVariant指定每个数据系列的数据行或列中。可以是下列的Office.XlRowCol常量之一: xlRowsxlColumnsSpecifies whether the data for each series is in rows or columns. Can be one of the following Office.XlRowCol constants: xlRows or xlColumns.
varCategoryLabelsvarCategoryLabels可选OptionalVariantVariant一个整数,指定的行或包含分类标签的源范围内的列数。值可以从 0 (零) 到相应类别或系列的最大数目减一。An integer that specifies the number of rows or columns within the source range that contain category labels. Values can be from 0 (zero) through one less than the maximum number of the corresponding categories or series.
varSeriesLabelsvarSeriesLabels可选OptionalVariantVariant一个整数,指定行或列源范围中包含系列标签的数量。值可以从 0 (零) 到相应类别或系列的最大数目减一。An integer that specifies the number of rows or columns within the source range that contain series labels. Values can be from 0 (zero) through one less than the maximum number of the corresponding categories or series.
varHasLegendvarHasLegend可选OptionalVariantVariant设置包含一个图例。Set True to include a legend.
varTitlevarTitle可选OptionalVariantVariant图表标题。The chart title.
varCategoryTitlevarCategoryTitle可选OptionalVariantVariant分类轴标题。The category axis title.
varValueTitlevarValueTitle可选OptionalVariantVariant数值轴标题。The value axis title.
varExtraTitlevarExtraTitle可选OptionalVariantVariant三维图表的系列轴标题,或二维图表的次数值轴标题。The series axis title for 3-D charts or the second value axis title for 2-D charts.

返回值Return value



您可以使用图表向导方法快速设定图表的格式,而不必设置所有单个属性。本方法是非交互式的并且它会更改指定的属性。自动套用格式方法可以做为图表向导使用只有_varGallery_和_varFormat_参数调用同一个作业。You can use the ChartWizard method to quickly format a chart without setting all the individual properties. This method is noninteractive, and it changes only the specified properties. TheAutoFormat method can do the same job as a call to ChartWizard that uses only the varGallery and varFormat parameters.

如果省略_Source_参数和所选内容不是活动的报告上的嵌入的图表或者活动报告不包含图表,图表向导方法会失败并发生错误。If the Source parameter is omitted and the selection isn't an embedded chart on the active report, or the active report does not contain a chart, the ChartWizard method fails and an error occurs.


下面的示例重新设置活动报告为折线图图表的格式、 添加图例,并添加类别和值轴标题。The following example reformats the chart on the active report as a line chart, adds a legend, and adds category and value axis titles.

Sub TestChartWizard()
    Dim chartShape As Shape
    Dim reportName As String

    reportName = "Simple scalar chart"
    Set chartShape = ActiveProject.Reports(reportName).Shapes(1)

    chartShape.Chart.ChartWizard varGallery:=xlLine, varHasLegend:=True, varCategoryTitle:="Task", varValueTitle:="Hours"
End Sub

另请参阅See also

其他资源Other resources

图表对象自动套用格式的方法Chart ObjectAutoFormat Method

© 2018 Microsoft