Chart.ChartWizard Method
Modifies the properties of the given Chart control. You can use this method to quickly format a Chart control without setting all the individual properties. This method is non-interactive, and it changes only the specified properties.
Namespace: Microsoft.Office.Tools.Excel
Assembly: Microsoft.Office.Tools.Excel (in Microsoft.Office.Tools.Excel.dll)
Syntax
'Declaration
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 _
)
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.ObjectThe 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 control on the active worksheet.
Gallery
Type: System.ObjectXlChartType. The chart type.
Format
Type: System.ObjectThe 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, Excel chooses a default value based on the gallery type and data source.
PlotBy
Type: System.ObjectSpecifies 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.ObjectAn 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.ObjectAn integer specifying 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.Objecttrue to include a legend.
Title
Type: System.ObjectThe Chart control title text.
CategoryTitle
Type: System.ObjectThe category axis title text.
ValueTitle
Type: System.ObjectThe value axis title text
ExtraTitle
Type: System.ObjectThe series axis title for 3-D charts or the second value axis title for 2-D charts.
Remarks
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 create a 3-D column chart that displays the data series in the range of cells A1 to B5.
Private Sub Create3DColumnChart()
Me.Range("A1", "A5").Value2 = 22
Me.Range("B1", "B5").Value2 = 55
Dim Chart1 As Microsoft.Office.Tools.Excel.Chart = _
Me.Controls.AddChart(Me.Range("D2", "H12"), "Chart1")
Chart1.ChartWizard(Me.Range("A1", "B5"), _
Excel.XlChartType.xl3DColumn, PlotBy:=Excel.XlRowCol.xlColumns)
End Sub
private void Create3DColumnChart()
{
this.Range["A1", "A5"].Value2 = 22;
this.Range["B1", "B5"].Value2 = 55;
Microsoft.Office.Tools.Excel.Chart chart1 =
this.Controls.AddChart(this.Range["D2", "H12"],
"chart1");
chart1.ChartWizard(this.Range["A1", "B5"],
Excel.XlChartType.xl3DColumn,
Excel.XlRowCol.xlColumns);
}
.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.