ChartSheetBase.ChartWizard Method
Modifies the properties of the given Microsoft.Office.Tools.Excel.ChartSheetBase.
Namespace: Microsoft.Office.Tools.Excel
Assembly: Microsoft.Office.Tools.Excel.v4.0.Utilities (in Microsoft.Office.Tools.Excel.v4.0.Utilities.dll)
Syntax
'Declaration
Public Sub ChartWizard ( _
source As Object, _
gallery As Object, _
format As Object, _
plotBy As Object, _
categoryLabels As Object, _
seriesLabels As Object, _
hasLegend As Object, _
title As Object, _
categoryTitle As Object, _
valueTitle As Object, _
extraTitle As Object _
)
public void ChartWizard(
Object source,
Object gallery,
Object format,
Object plotBy,
Object categoryLabels,
Object seriesLabels,
Object hasLegend,
Object title,
Object categoryTitle,
Object valueTitle,
Object extraTitle
)
Parameters
- source
Type: System.Object
The range that contains the source data for the new chart. If this argument is omitted, Microsoft Office Excel edits the active chart sheet or the selected chart on the active worksheet.
- gallery
Type: System.Object
The chart type.
- format
Type: System.Object
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, Microsoft Office Excel chooses a default value based on the gallery type and data source.
- plotBy
Type: System.Object
Specifies whether the data for each series is in rows or columns. Can be one of the following XlRowCol constants: xlRows or xlColumns.
- categoryLabels
Type: System.Object
An integer specifying the number of rows or columns within the source range that contain category labels. Legal values are from 0 (zero) through one less than the maximum number of the corresponding categories or series.
- seriesLabels
Type: System.Object
The number of rows or columns within the source range that contain series labels. Legal values are from 0 (zero) through one less than the maximum number of the corresponding categories or series.
- hasLegend
Type: System.Object
true to include a legend.
- title
Type: System.Object
The chart title text.
- categoryTitle
Type: System.Object
The category axis title text.
- valueTitle
Type: System.Object
The value axis title text
- extraTitle
Type: System.Object
The series axis title for 3-D charts or the second value axis title for 2-D charts.
Remarks
You can use this method to quickly format a Microsoft.Office.Tools.Excel.ChartSheetBase without setting all the individual properties. This method is non-interactive, and it changes only the specified properties.
If Source is omitted and either the selection is not an embedded chart on the active worksheet or the active sheet is not an existing chart, this method fails and an error occurs.
Optional Parameters
For information on optional parameters, see Optional Parameters in Office Solutions.
Examples
The following code example uses the ChartWizard method to set the data source and the chart type of the current Microsoft.Office.Tools.Excel.ChartSheetBase.
Private Sub ModifyChartSheet()
Globals.Sheet1.Range("A1", "A5").Value2 = 22
Globals.Sheet1.Range("B1", "B5").Value2 = 55
Me.ChartWizard(Source:=Globals.Sheet1.Range("A1", "B5"), _
Gallery:=Excel.XlChartType.xl3DColumn, _
HasLegend:=False, Title:="Revised chart")
End Sub
private void ModifyChartSheet()
{
Globals.Sheet1.Range["A1", "A5"].Value2 = 22;
Globals.Sheet1.Range["B1", "B5"].Value2 = 55;
this.ChartWizard(Globals.Sheet1.Range["A1", "B5"],
Excel.XlChartType.xl3DColumn, missing,
missing, missing, missing, false,
"Revised chart", missing, missing, missing);
}
.NET Framework Security
- Full trust for the immediate caller. This member cannot be used by partially trusted code. For more information, see Using Libraries from Partially Trusted Code.