' 凡例とタイトルを生成します。
Dim legend1 As New GrapeCity.ActiveReports.Chart.Legend
Dim lHeader As New GrapeCity.ActiveReports.Chart.Title
' タイトルのプロパティを設定します。
lHeader.Backdrop = New GrapeCity.ActiveReports.Chart.Graphics.Backdrop(Chart.Graphics.BackdropStyle.Transparent, _
Color.White, Color.White, Chart.Graphics.GradientType.Vertical, Drawing2D.HatchStyle.DottedGrid, Nothing, _
Chart.Graphics.PicturePutStyle.Stretched)
lHeader.Border = New GrapeCity.ActiveReports.Chart.Border(New Chart.Graphics.Line(Color.White, 2, _
Chart.Graphics.LineStyle.None), 0, Color.Black)
lHeader.Font = New GrapeCity.ActiveReports.Chart.FontInfo(Color.White, New System.Drawing.Font("Arial", 10.0F, _
FontStyle.Bold))
lHeader.Text = "Series:"
' 凡例のプロパティを設定し、それを凡例コレクションに追加します。
legend1.Alignment = GrapeCity.ActiveReports.Chart.Alignment.TopRight
legend1.Backdrop = New GrapeCity.ActiveReports.Chart.BackdropItem(Chart.Graphics.BackdropStyle.Transparent, _
Color.Gray, Color.White, Chart.Graphics.GradientType.Vertical, Drawing2D.HatchStyle.DottedGrid, Nothing, _
Chart.Graphics.PicturePutStyle.Stretched)
legend1.Border = New GrapeCity.ActiveReports.Chart.Border(New Chart.Graphics.Line(Color.Navy, 2), _
0, Color.Black)
legend1.DockArea = Me.ChartControl1.ChartAreas(0)
legend1.LabelsFont = New GrapeCity.ActiveReports.Chart.FontInfo(Color.White, New System.Drawing.Font("Arial", 9.0F))
legend1.Header = lHeader
legend1.MarginX = 5
legend1.MarginY = 5
Me.ChartControl1.Legends.Add(legend1)
' 凡例項目を生成します。
Dim legenditem As New GrapeCity.ActiveReports.Chart.LegendItem
Dim legenditem2 As New GrapeCity.ActiveReports.Chart.LegendItem
' 凡例項目のプロパティを設定します。
legenditem.Text = "High Range"
legenditem2.Text = "Low Range"
legenditem.Marker.Style = Chart.MarkerStyle.None
legenditem2.Marker.Style = Chart.MarkerStyle.None
legenditem.Border.Line.Style = Chart.Graphics.LineStyle.None
legenditem2.Border.Line.Style = Chart.Graphics.LineStyle.None
legenditem.Backdrop = New GrapeCity.ActiveReports.Chart.BackdropItem(System.Drawing.Color.LightSteelBlue, _
Chart.Graphics.AntiAliasMode.Auto)
legenditem2.Backdrop = New GrapeCity.ActiveReports.Chart.BackdropItem(System.Drawing.Color.LightGray, _
Chart.Graphics.AntiAliasMode.Auto)
' 凡例コレクションへ追加します。
legend1.LegendItems.Add(legenditem)
legend1.LegendItems.Add(legenditem2)
' 作成した凡例をデータセットの凡例プロパティに設定します。
Me.ChartControl1.Series(0).Legend = legend1
Me.ChartControl1.Series(1).Legend = legend1
Me.ChartControl1.Series(2).Legend = legend1
|