HOWTO: Set the FillColor in the MS Chart Control at Run- timeID: Q177997
|
With the Microsoft Chart control, the FillColor property allows you to
change the color of different objects in the chart such as data points,
shadows, walls, and markers. The FillColor property has a Red, Blue, and
Green property that you set to an integer value to control the value of
that color component.
This article illustrates how you can set the FillColor property at run-time
by showing you how to create a project that will change the bar colors of
chart. This information can be applied to other chart objects that support
the FillColor property.
Option Explicit
Private Sub Form_Load()
MSChart1.ColumnCount = 1
Label1.Caption = "Red Value:"
Label2.Caption = "Green Value:"
Label3.Caption = "Blue Value:"
Text1.Text = "0"
Text2.Text = "0"
Text3.Text = "0"
Command1.Caption = "Change Bar Color"
Command1_Click
End Sub
Private Sub Command1_Click()
'This event changes the bar colors of the graph.
With MSChart1.Plot.SeriesCollection(1).DataPoints(-1)
.Brush.Style = VtBrushStyleSolid
.Brush.FillColor.Red = CInt(Text1.Text)
.Brush.FillColor.Green = CInt(Text2.Text)
.Brush.FillColor.Blue = CInt(Text3.Text)
End With
End Sub
For additional information on the MS Chart control, you can download a
sample file from the Visual Basic Owner's site. Please see the following
article in the Microsoft Knowledge Base for download instructions:
Q175212 : FILE: Visual Basic MSChart Sample
Additional query words:
MSChart charting graph graphing series kbVBp500 kbVBp600 kbVBp
kbdsd kbDSupport kbControl
Keywords :
Version :
Platform : WINDOWS
Issue type : kbhowto
Last Reviewed: May 12, 1999