系列オブジェクト (Project)

グラフの行または列を作成する関連データのコレクションを表します。

注釈

Series オブジェクトは、グラフのすべてのデータ系列を含む SeriesCollection コレクションのメンバーです。 系列の名前は、多くの場合、チャートの凡例に表示されます。

次の例では、グラフ上にデータ系列のコレクションの系列名、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
名前
Parent
XValues

関連項目

Chart オブジェクト

サポートとフィードバック

Office VBA またはこの説明書に関するご質問やフィードバックがありますか? サポートの受け方およびフィードバックをお寄せいただく方法のガイダンスについては、Office VBA のサポートおよびフィードバックを参照してください。