グラフにデータが存在するときは、グラフは自動的に凡例を生成します。グラフは、データセットの Chart3DDataSet オブジェクトにデータセット識別子として指定された名前を割り当てます。Chart3DLineStyle オブジェクトと Chart3DSymbolStyle オブジェクトは、凡例のデータセット名に付随するシンボルを決定します。凡例にの表示位置や凡例に使用する枠線、色、およびフォントをカスタマイズできます。.
プロパティの設定例を以下に示します。
Visual Basic コードの書き方
| Visual Basic |
コードのコピー
|
|---|---|
C1Chart3D1.Legend.Compass = CompassEnum.East C1Chart3D1.Legend.Style.Border.BorderStyle = BorderStyleEnum.Solid C1Chart3D1.Legend.Style.Border.Thickness = 3 C1Chart3D1.Legend.Style.Border.Color = Color.Black C1Chart3D1.Legend.Style.BackColor = Color.Gray C1Chart3D1.Legend.Text = "凡例のテキスト" |
|
C# コードの書き方
| C# |
コードのコピー
|
|---|---|
c1Chart3D1.Legend.Compass = CompassEnum.East; c1Chart3D1.Legend.Style.Border.BorderStyle = BorderStyleEnum.Solid; c1Chart3D1.Legend.Style.Border.Thickness = 3; c1Chart3D1.Legend.Style.Border.Color = Color.Black; c1Chart3D1.Legend.Style.BackColor = Color.Gray; c1Chart3D1.Legend.Text = "凡例のテキスト"; |
|
メモ:VB.NET では、With および End With ステートメントを使用して、同じオブジェクトの反復使用の表現をより簡単に行うことができます。このメソッドを使用すると、上述のコードは次のように表現されます。
Visual Basic コードの書き方
| Visual Basic |
コードのコピー
|
|---|---|
With C1Chart3D1.Legend
.Compass = CompassEnum.East
With .Style
With.Border
.BorderStyle = BorderStyleEnum.Solid
.Thickness = 3
.Color = Color.Black
End With
.BackColor = Color.Gray
End With
.Text = "凡例のテキスト"
End With
|
|
C# コードの書き方
| C# |
コードのコピー
|
|---|---|
C1.Win.C1Chart3D.Legend legend = C1Chart3D1.Legend;
C1.Win.C1Chart3D.Style style = legend.Style;
C1.Win.C1Chart3D.Border border = style.Border;
legend.Compass = CompassEnum.East;
border.BorderStyle = BorderStyleEnum.Solid;
border.Thickness = 3;
border.Color = Color.Black;
style.BackColor = Color.Grey;
legend.Text = "凡例のテキスト";
|
|
