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
- 参考情報
- [VB] MSChart:チャート コントロールにデータ ポイント ラベルを記述する方法
- [VB] MSChart:チャート コントロールの設定を実行時に行う方法
- How To Label Pie Slices as Percentages in MSChart Pie Chart
- MSChartの使い方
- VBレスキュ−(花ちゃん)
- The Code Project -Series Values inside Pie Chart. -Miscellaneous Controls
- MSサポート情報 [VB-4]