|
-
May 16th, 2011, 01:22 PM
#1
Thread Starter
Member
VB6 MsChart Control DataPoint Selection
I am trying to figure out how to set a data point selection from a list box to the mschart.
Chart is a 2d Line
I can get the data point to select the index in my list box with the MSChart1_PointSelected event code at the bottom
But I cannot get the list box to set a point.
I am using the following Code in the list box click event:
Private Sub List2_Click()
'Single series line Chart 2D
'list2 refers to the y axis datapoint value (drop)in Inches
'List1 refers to the x axis datapoint value in (Range in Yards)
List1.ListIndex = List2.ListIndex ' get y value by duplicating index values for listboxes
MSChart1.AllowSelections = True
'Method Format SelectPart (part, index1, index2, index3, index4)
'set mschart and list control to equivalnet index values
Dim ChartIndexCorrect As Long
Dim ChartSeries As Long
ChartSeries = 1
ChartIndexCorrect = List2.ListIndex + 1
MSChart1.SelectPart VtChPartTypePoint, ChartSeries, ChartIndexCorrect, 0, 0
'index1 Integer
'If part refers to a series or a data point, this argument specifies which series.
'Series are numbered in the order their corresponding columns appear in the data grid
'from left to right, beginning with 1
'index2 Integer.
'If part refers to a data point, this argument specifies which data point in the
'series is identified by index1. Data points are numbered in the order their corresponding
'rows appear in the data grid from top to bottom, beginning with 1.
Exit Sub
Error:
MsgBox ("Error Number " & err.Number & vbCrLf & err.Description), vbExclamation, "Set DataPoint Error"
End Sub
Private Sub MSChart1_PointSelected(Series As Integer, DataPoint As Integer, MouseFlags As Integer, Cancel As Integer)
If selecting = True Then Exit Sub
'list2 refers to the x axis Yards
'List1 refers to the y axis Path
List1.ListIndex = DataPoint - 1
List2.ListIndex = DataPoint - 1
StatusBar1.Panels(2) = "Drop = " & List1 & " Inches"
StatusBar1.Panels(1) = "Range = " & List2 & " Yards"
End Sub
Nothing happens no error but also no data point selection either.
Any Help would be appriciated.
Thanks in Advance
Don
-
May 16th, 2011, 04:12 PM
#2
Thread Starter
Member
Re: VB6 MsChart Control DataPoint Selection
I figured it out.
just needed to add setfocus after selection.
MSChart1.AllowSelections = True
Dim ChartSeries As Long
ChartSeries = 1 ' or mschart1.col
ChartIndexCorrect = List2.ListIndex + 1
MSChart1.SelectPart VtChPartTypePoint, ChartSeries, ChartIndexCorrect, vbNull, vbNull
MSChart1.SetFocus
MSChart1.AllowSelections = False
Posting Permissions
- You may not post new threads
- You may not post replies
- You may not post attachments
- You may not edit your posts
-
Forum Rules
|
Click Here to Expand Forum to Full Width
|