代表一組資料系列 (系列物件在 圖表中) 。
註解
每個系列是相關資料的集合,代表圖表中的一列或一欄。 系列名稱通常會顯示在圖表圖例中。
範例
以下範例列印系列名稱,X (水平) 值,Y (垂直) 值,代表圖表上資料系列的集合。
Sub TestChartSeries()
Dim reportName As String
Dim theReportIndex As Integer
Dim theChart As Chart
Dim seriesCollec As SeriesCollection
Dim chartSeries As Series
Dim i As Integer
Dim j As Integer
reportName = "Simple scalar chart"
theReportIndex = -1
If (ActiveProject.Reports.IsPresent(reportName)) Then
' Make the report active.
theReportIndex = ActiveProject.Reports(reportName).Index
ActiveProject.Reports(theReportIndex).Apply
Set theChart = ActiveProject.Reports(theReportIndex).Shapes(1).Chart
Set seriesCollec = theChart.SeriesCollection()
For i = 1 To seriesCollec.Count
Set chartSeries = seriesCollec(i)
If (IsEmpty(chartSeries.Name)) Then
Debug.Print "Series " & i & " name is an empty string."
Else
Debug.Print "Series " & i & ": " & chartSeries.Name
End If
For j = 1 To seriesCollec.Count
Debug.Print vbTab & "X, Y values(" & j & "): " & chartSeries.XValues(j) _
& ", " & chartSeries.Values(j); ""
Next j
Next i
End If
End Sub
以下範例輸出來自圖表,例如 圖表物件文件 中的範例。
Series 1: Actual Work
X, Y values(1): T1, 16
X, Y values(2): T2 - new, 32
X, Y values(3): T3, 7
Series 2: Remaining Work
X, Y values(1): T1, 0
X, Y values(2): T2 - new, 16
X, Y values(3): T3, 17
Series 3: Work
X, Y values(1): T1, 16
X, Y values(2): T2 - new, 48
X, Y values(3): T3, 24
方法
| 名稱 |
|---|
| 項目 |
屬性
| 名稱 |
|---|
| Application |
| 數目 |
| Creator |
| Parent |
另請參閱
支援和意見反應
有關於 Office VBA 或這份文件的問題或意見反應嗎? 如需取得支援服務並提供意見反應的相關指導,請參閱 Office VBA 支援與意見反應。