Chart.ChartType 속성
차트 서식을 가져오거나 설정합니다.
네임스페이스: Microsoft.Office.Tools.Excel
어셈블리: Microsoft.Office.Tools.Excel(Microsoft.Office.Tools.Excel.dll)
구문
‘선언
Property ChartType As XlChartType
XlChartType ChartType { get; set; }
속성 값
형식: Microsoft.Office.Interop.Excel.XlChartType
XlChartType 값 중 하나입니다.
설명
일부 차트 서식은 피벗 차트 보고서에서 사용할 수 없습니다.
예제
다음 코드 예제에서는 세로 막대형 Chart를 만든 다음 ChartType 속성을 사용하여 사용자에게 차트를 3차원 원형 차트로 바꾸도록 요청하는 프롬프트를 표시합니다.
Private Sub SetChartType()
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.SetSourceData(Me.Range("A1", "B5"), Excel.XlRowCol.xlColumns)
Chart1.ChartType = Excel.XlChartType.xlColumnClustered
If DialogResult.Yes = _
MessageBox.Show("Change the chart type to a 3-D pie chart?", _
"Example", MessageBoxButtons.YesNo) Then
Chart1.ChartType = Excel.XlChartType.xl3DPie
End If
End Sub
private void SetChartType()
{
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.SetSourceData(this.Range["A1", "B5"],
Excel.XlRowCol.xlColumns);
chart1.ChartType = Excel.XlChartType.xlColumnClustered;
if (DialogResult.Yes ==
MessageBox.Show("Change the chart type to a 3-D pie chart?",
"Example", MessageBoxButtons.YesNo))
{
chart1.ChartType = Excel.XlChartType.xl3DPie;
}
}
.NET Framework 보안
- 직접 실행 호출자의 경우 완전히 신뢰합니다. 이 멤버는 부분적으로 신뢰할 수 있는 코드에서 사용할 수 없습니다. 자세한 내용은 부분 신뢰 코드에서 라이브러리 사용을 참조하십시오.