VB 関連情報

サンプルコード

MSChart(円グラフ)のサンプル

Private Sub Command1_Click()
    With MSChart1
        ' 円グラフを指定
        .chartType = VtChChartType2dPie
        
        ' テストデータ
        For i = 1 To 4
            .Row = 1
            .Column = i
            .Data = Rnd() * 100 ' ランダムな値(100点満点)をセット
        Next
        
        With .DataGrid
            .RowLabelCount = 1
            .ColumnCount = 4
            .RowCount = 1
            For i = 1 To .ColumnCount
                .ColumnLabel(i, 1) = "Column " & i
            Next i
            .RowLabel(1, 1) = "成績グラフ"
        End With
        
        ' 項目の表示内容のカスタマイズ
        For i = 1 To .Plot.SeriesCollection.Count
            
            With .Plot.SeriesCollection(i).DataPoints(-1).DataPointLabel
               ' ラベルはパイのスライスの内部に表示されます。
               .LocationType = VtChLabelLocationTypeInside
               ' データ ポイントの値がラベルに表示されます。
               .Component = VtChLabelComponentValue
                Select Case i
                Case 1
                   .ValueFormat = "国語 0"
                Case 2
                   .ValueFormat = "算数 0"
                Case 3
                   .ValueFormat = "理科 0"
                Case 4
                   .ValueFormat = "社会 0"
                End Select
            End With
        Next i
        
    End With
    
End Sub

トップ   新規 一覧 単語検索 最終更新   ヘルプ   最終更新のRSS